gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 492HTML 238TOML 3CSS 11131 Definiciones

⎇ 0.1.x benches/generated/margin_auto_left_right_child_bigger_than_parent.rs Rust · 36 líneas · 1.2 KB Historia Quién tocó qué crudo

Rename sprawl to taffy (#134) 8936790d6 · Alice Cecile ·

1pub fn compute() {
2    let mut taffy = taffy::Taffy::new();
3    let node0 = taffy
4        .new_node(
5            taffy::style::Style {
6                size: taffy::geometry::Size {
7                    width: taffy::style::Dimension::Points(72f32),
8                    height: taffy::style::Dimension::Points(72f32),
9                    ..Default::default()
10                },
11                margin: taffy::geometry::Rect {
12                    start: taffy::style::Dimension::Auto,
13                    end: taffy::style::Dimension::Auto,
14                    ..Default::default()
15                },
16                ..Default::default()
17            },
18            &[],
19        )
20        .unwrap();
21    let node = taffy
22        .new_node(
23            taffy::style::Style {
24                justify_content: taffy::style::JustifyContent::Center,
25                size: taffy::geometry::Size {
26                    width: taffy::style::Dimension::Points(52f32),
27                    height: taffy::style::Dimension::Points(52f32),
28                    ..Default::default()
29                },
30                ..Default::default()
31            },
32            &[node0],
33        )
34        .unwrap();
35    taffy.compute_layout(node, taffy::geometry::Size::undefined()).unwrap();
36}