gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 499HTML 238Markdown 7TOML 31442 Definiciones

⎇ d8c8bb472833ba92d694a9420e4c5bd8308e32e3 benches/generated/absolute_layout_in_wrap_reverse_column_container.rs Rust · 35 líneas · 1.2 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                position_type: taffy::style::PositionType::Absolute,
9                size: taffy::geometry::Size {
10                    width: taffy::style::Dimension::Points(20f32),
11                    height: taffy::style::Dimension::Points(20f32),
12                    ..Size::auto()
13                },
14                ..Default::default()
15            },
16            &[],
17        )
18        .unwrap();
19    let node = taffy
20        .new_with_children(
21            taffy::style::Style {
22                flex_direction: taffy::style::FlexDirection::Column,
23                flex_wrap: taffy::style::FlexWrap::WrapReverse,
24                size: taffy::geometry::Size {
25                    width: taffy::style::Dimension::Points(100f32),
26                    height: taffy::style::Dimension::Points(100f32),
27                    ..Size::auto()
28                },
29                ..Default::default()
30            },
31            &[node0],
32        )
33        .unwrap();
34    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
35}