gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 500HTML 254C 19JavaScript 81398 Definiciones

⎇ d8c8bb472833ba92d694a9420e4c5bd8308e32e3 benches/generated/wrapped_row_within_align_items_flex_start.rs Rust · 53 líneas · 1.8 KB Historia Quién tocó qué crudo

Strict types for style values (#269) 0d8c198a9 · Nico Burns ·

1pub fn compute() {
2    #[allow(unused_imports)]
3    use taffy::prelude::*;
4    let mut taffy = taffy::Taffy::new();
5    let node00 = taffy
6        .new_with_children(
7            taffy::style::Style {
8                size: taffy::geometry::Size {
9                    width: taffy::style::Dimension::Points(150f32),
10                    height: taffy::style::Dimension::Points(80f32),
11                    ..Size::auto()
12                },
13                ..Default::default()
14            },
15            &[],
16        )
17        .unwrap();
18    let node01 = taffy
19        .new_with_children(
20            taffy::style::Style {
21                size: taffy::geometry::Size {
22                    width: taffy::style::Dimension::Points(80f32),
23                    height: taffy::style::Dimension::Points(80f32),
24                    ..Size::auto()
25                },
26                ..Default::default()
27            },
28            &[],
29        )
30        .unwrap();
31    let node0 = taffy
32        .new_with_children(
33            taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, ..Default::default() },
34            &[node00, node01],
35        )
36        .unwrap();
37    let node = taffy
38        .new_with_children(
39            taffy::style::Style {
40                flex_direction: taffy::style::FlexDirection::Column,
41                align_items: taffy::style::AlignItems::FlexStart,
42                size: taffy::geometry::Size {
43                    width: taffy::style::Dimension::Points(200f32),
44                    height: taffy::style::Dimension::Points(200f32),
45                    ..Size::auto()
46                },
47                ..Default::default()
48            },
49            &[node0],
50        )
51        .unwrap();
52    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
53}