gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 684HTML 640Markdown 12TOML 62290 Definiciones

⎇ 0.2.x benches/generated/parent_wrap_child_size_overflowing_parent.rs Rust · 39 líneas · 1.3 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 node00 = taffy
4        .new_with_children(
5            taffy::style::Style {
6                size: taffy::geometry::Size {
7                    width: taffy::style::Dimension::Points(100f32),
8                    height: taffy::style::Dimension::Points(200f32),
9                    ..Default::default()
10                },
11                ..Default::default()
12            },
13            &[],
14        )
15        .unwrap();
16    let node0 = taffy
17        .new_with_children(
18            taffy::style::Style {
19                size: taffy::geometry::Size { width: taffy::style::Dimension::Points(100f32), ..Default::default() },
20                ..Default::default()
21            },
22            &[node00],
23        )
24        .unwrap();
25    let node = taffy
26        .new_with_children(
27            taffy::style::Style {
28                size: taffy::geometry::Size {
29                    width: taffy::style::Dimension::Points(100f32),
30                    height: taffy::style::Dimension::Points(100f32),
31                    ..Default::default()
32                },
33                ..Default::default()
34            },
35            &[node0],
36        )
37        .unwrap();
38    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
39}