gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81414 Sutichaykuna

⎇ d8c8bb472833ba92d694a9420e4c5bd8308e32e3 benches/generated/flex_basis_smaller_than_content_column.rs Rust · 39 siq'ikuna · 1.3 KB Ñawpa willay Pi imata llamkarqan ch'uya

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(100f32),
10                    height: taffy::style::Dimension::Points(100f32),
11                    ..Size::auto()
12                },
13                ..Default::default()
14            },
15            &[],
16        )
17        .unwrap();
18    let node0 = taffy
19        .new_with_children(
20            taffy::style::Style {
21                flex_direction: taffy::style::FlexDirection::Column,
22                flex_basis: taffy::style::Dimension::Points(50f32),
23                ..Default::default()
24            },
25            &[node00],
26        )
27        .unwrap();
28    let node = taffy
29        .new_with_children(
30            taffy::style::Style {
31                flex_direction: taffy::style::FlexDirection::Column,
32                size: taffy::geometry::Size { height: taffy::style::Dimension::Points(100f32), ..Size::auto() },
33                ..Default::default()
34            },
35            &[node0],
36        )
37        .unwrap();
38    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
39}