tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 1111HTML 1039Markdown 12TOML 94541 Definitions

⎇ 0.1.x benches/generated/justify_content_row_max_width_and_margin.rs Rust · 29 lines · 1.1 KB History Who touched what raw

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(20f32),
8                    height: taffy::style::Dimension::Points(20f32),
9                    ..Default::default()
10                },
11                margin: taffy::geometry::Rect { start: taffy::style::Dimension::Points(100f32), ..Default::default() },
12                ..Default::default()
13            },
14            &[],
15        )
16        .unwrap();
17    let node = taffy
18        .new_node(
19            taffy::style::Style {
20                justify_content: taffy::style::JustifyContent::Center,
21                size: taffy::geometry::Size { width: taffy::style::Dimension::Points(100f32), ..Default::default() },
22                max_size: taffy::geometry::Size { width: taffy::style::Dimension::Points(80f32), ..Default::default() },
23                ..Default::default()
24            },
25            &[node0],
26        )
27        .unwrap();
28    taffy.compute_layout(node, taffy::geometry::Size::undefined()).unwrap();
29}