tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 583HTML 275Markdown 8TOML 41586 Definiciones

⎇ 9e53f03adea2b770d68954e404d2fa407dfc7d40 benches/generated/size_defined_by_child_with_padding.rs Rust · 32 líneas · 1.1 KB Historia Quién tocó qué crudo

Layout algorithm decoupling, Sizing Constraints & Perf Improvements (#246) ba4cd3c3b · Nico Burns ·

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