tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 1061HTML 997Markdown 12TOML 83120 Definiciones

⎇ 0.1.x benches/generated/display_none_fixed_size.rs Rust · 32 líneas · 1.1 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.new_node(taffy::style::Style { flex_grow: 1f32, ..Default::default() }, &[]).unwrap();
4    let node1 = taffy
5        .new_node(
6            taffy::style::Style {
7                display: taffy::style::Display::None,
8                size: taffy::geometry::Size {
9                    width: taffy::style::Dimension::Points(20f32),
10                    height: taffy::style::Dimension::Points(20f32),
11                    ..Default::default()
12                },
13                ..Default::default()
14            },
15            &[],
16        )
17        .unwrap();
18    let node = taffy
19        .new_node(
20            taffy::style::Style {
21                size: taffy::geometry::Size {
22                    width: taffy::style::Dimension::Points(100f32),
23                    height: taffy::style::Dimension::Points(100f32),
24                    ..Default::default()
25                },
26                ..Default::default()
27            },
28            &[node0, node1],
29        )
30        .unwrap();
31    taffy.compute_layout(node, taffy::geometry::Size::undefined()).unwrap();
32}