tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 788HTML 740Markdown 12TOML 62536 Definiciones

⎇ 0.1.x benches/generated/justify_content_column_flex_end.rs Rust · 46 líneas · 1.5 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 { height: taffy::style::Dimension::Points(10f32), ..Default::default() },
7                ..Default::default()
8            },
9            &[],
10        )
11        .unwrap();
12    let node1 = taffy
13        .new_node(
14            taffy::style::Style {
15                size: taffy::geometry::Size { height: taffy::style::Dimension::Points(10f32), ..Default::default() },
16                ..Default::default()
17            },
18            &[],
19        )
20        .unwrap();
21    let node2 = taffy
22        .new_node(
23            taffy::style::Style {
24                size: taffy::geometry::Size { height: taffy::style::Dimension::Points(10f32), ..Default::default() },
25                ..Default::default()
26            },
27            &[],
28        )
29        .unwrap();
30    let node = taffy
31        .new_node(
32            taffy::style::Style {
33                flex_direction: taffy::style::FlexDirection::Column,
34                justify_content: taffy::style::JustifyContent::FlexEnd,
35                size: taffy::geometry::Size {
36                    width: taffy::style::Dimension::Points(100f32),
37                    height: taffy::style::Dimension::Points(100f32),
38                    ..Default::default()
39                },
40                ..Default::default()
41            },
42            &[node0, node1, node2],
43        )
44        .unwrap();
45    taffy.compute_layout(node, taffy::geometry::Size::undefined()).unwrap();
46}