gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 788HTML 740Markdown 12TOML 62536 Definiciones

⎇ 0.2.x benches/generated/display_none_with_position.rs Rust · 29 líneas · 1.1 KB Historia Quién tocó qué crudo

Rename FlexboxLayout back to Style (#251) 49893a7d9 · Nico Burns ·

1pub fn compute() {
2    let mut taffy = taffy::Taffy::new();
3    let node0 = taffy.new_with_children(taffy::style::Style { flex_grow: 1f32, ..Default::default() }, &[]).unwrap();
4    let node1 = taffy
5        .new_with_children(
6            taffy::style::Style {
7                display: taffy::style::Display::None,
8                flex_grow: 1f32,
9                position: taffy::geometry::Rect { top: taffy::style::Dimension::Points(10f32), ..Default::default() },
10                ..Default::default()
11            },
12            &[],
13        )
14        .unwrap();
15    let node = taffy
16        .new_with_children(
17            taffy::style::Style {
18                size: taffy::geometry::Size {
19                    width: taffy::style::Dimension::Points(100f32),
20                    height: taffy::style::Dimension::Points(100f32),
21                    ..Default::default()
22                },
23                ..Default::default()
24            },
25            &[node0, node1],
26        )
27        .unwrap();
28    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
29}