tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 1113HTML 1039Markdown 12TOML 94695 Definiciones

⎇ d67e82255da07928c7e415ea7364529d204bbaf9 benches/generated/absolute_layout_width_height_start_top_end_bottom.rs Rust · 38 líneas · 1.4 KB Historia Quién tocó qué crudo

rename stretch to stretch2 79aa44fa4 · elbaro ·

1pub fn compute() {
2    let mut stretch = stretch2::Stretch::new();
3    let node0 = stretch
4        .new_node(
5            stretch2::style::Style {
6                position_type: stretch2::style::PositionType::Absolute,
7                size: stretch2::geometry::Size {
8                    width: stretch2::style::Dimension::Points(10f32),
9                    height: stretch2::style::Dimension::Points(10f32),
10                    ..Default::default()
11                },
12                position: stretch2::geometry::Rect {
13                    start: stretch2::style::Dimension::Points(10f32),
14                    end: stretch2::style::Dimension::Points(10f32),
15                    top: stretch2::style::Dimension::Points(10f32),
16                    bottom: stretch2::style::Dimension::Points(10f32),
17                    ..Default::default()
18                },
19                ..Default::default()
20            },
21            &[],
22        )
23        .unwrap();
24    let node = stretch
25        .new_node(
26            stretch2::style::Style {
27                size: stretch2::geometry::Size {
28                    width: stretch2::style::Dimension::Points(100f32),
29                    height: stretch2::style::Dimension::Points(100f32),
30                    ..Default::default()
31                },
32                ..Default::default()
33            },
34            &[node0],
35        )
36        .unwrap();
37    stretch.compute_layout(node, stretch2::geometry::Size::undefined()).unwrap();
38}