tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 1085HTML 1017Markdown 12TOML 83230 Definitions

⎇ 0.1.x benches/generated/justify_content_min_max.rs Rust · 36 lines · 1.3 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(60f32),
8                    height: taffy::style::Dimension::Points(60f32),
9                    ..Default::default()
10                },
11                ..Default::default()
12            },
13            &[],
14        )
15        .unwrap();
16    let node = taffy
17        .new_node(
18            taffy::style::Style {
19                flex_direction: taffy::style::FlexDirection::Column,
20                justify_content: taffy::style::JustifyContent::Center,
21                size: taffy::geometry::Size { width: taffy::style::Dimension::Points(100f32), ..Default::default() },
22                min_size: taffy::geometry::Size {
23                    height: taffy::style::Dimension::Points(100f32),
24                    ..Default::default()
25                },
26                max_size: taffy::geometry::Size {
27                    height: taffy::style::Dimension::Points(200f32),
28                    ..Default::default()
29                },
30                ..Default::default()
31            },
32            &[node0],
33        )
34        .unwrap();
35    taffy.compute_layout(node, taffy::geometry::Size::undefined()).unwrap();
36}