gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 701HTML 654Markdown 12TOML 62332 Definiciones

⎇ d8c8bb472833ba92d694a9420e4c5bd8308e32e3 benches/generated/justify_content_column_flex_end.rs Rust · 48 líneas · 1.6 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 node0 = taffy
6        .new_with_children(
7            taffy::style::Style {
8                size: taffy::geometry::Size { height: taffy::style::Dimension::Points(10f32), ..Size::auto() },
9                ..Default::default()
10            },
11            &[],
12        )
13        .unwrap();
14    let node1 = taffy
15        .new_with_children(
16            taffy::style::Style {
17                size: taffy::geometry::Size { height: taffy::style::Dimension::Points(10f32), ..Size::auto() },
18                ..Default::default()
19            },
20            &[],
21        )
22        .unwrap();
23    let node2 = taffy
24        .new_with_children(
25            taffy::style::Style {
26                size: taffy::geometry::Size { height: taffy::style::Dimension::Points(10f32), ..Size::auto() },
27                ..Default::default()
28            },
29            &[],
30        )
31        .unwrap();
32    let node = taffy
33        .new_with_children(
34            taffy::style::Style {
35                flex_direction: taffy::style::FlexDirection::Column,
36                justify_content: taffy::style::JustifyContent::FlexEnd,
37                size: taffy::geometry::Size {
38                    width: taffy::style::Dimension::Points(100f32),
39                    height: taffy::style::Dimension::Points(100f32),
40                    ..Size::auto()
41                },
42                ..Default::default()
43            },
44            &[node0, node1, node2],
45        )
46        .unwrap();
47    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
48}