gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 231Rust 10TOML 3CSS 1350 Definitions

⎇ 0.2.x benches/generated/rounding_flex_basis_flex_shrink_row.rs Rust · 39 lines · 1.2 KB History Who touched what raw

Rename FlexboxLayout back to Style (#251) 49893a7d9 · Nico Burns ·

1pub fn compute() {
2    let mut taffy = taffy::Taffy::new();
3    let node0 = taffy
4        .new_with_children(
5            taffy::style::Style {
6                flex_shrink: 1f32,
7                flex_basis: taffy::style::Dimension::Points(100f32),
8                ..Default::default()
9            },
10            &[],
11        )
12        .unwrap();
13    let node1 = taffy
14        .new_with_children(
15            taffy::style::Style { flex_basis: taffy::style::Dimension::Points(25f32), ..Default::default() },
16            &[],
17        )
18        .unwrap();
19    let node2 = taffy
20        .new_with_children(
21            taffy::style::Style { flex_basis: taffy::style::Dimension::Points(25f32), ..Default::default() },
22            &[],
23        )
24        .unwrap();
25    let node = taffy
26        .new_with_children(
27            taffy::style::Style {
28                size: taffy::geometry::Size {
29                    width: taffy::style::Dimension::Points(101f32),
30                    height: taffy::style::Dimension::Points(100f32),
31                    ..Default::default()
32                },
33                ..Default::default()
34            },
35            &[node0, node1, node2],
36        )
37        .unwrap();
38    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
39}