tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81414 Definiciones

⎇ 0.2.x benches/generated/display_none_fixed_size.rs Rust · 32 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                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_with_children(
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::MAX_CONTENT).unwrap();
32}