tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 231Rust 9TOML 3CSS 1345 Definitions

⎇ ec371711989b7f4d870d91bea4b66bdd94b45c9e benches/generated/justify_content_column_flex_start.rs Rust · 38 lines · 1.4 KB History Who touched what raw

Reinstate FlexStart and FlexEnd alignment variants (#336) 78fd9cc09 · 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_leaf(taffy::style::Style {
7            size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(10f32) },
8            ..Default::default()
9        })
10        .unwrap();
11    let node1 = taffy
12        .new_leaf(taffy::style::Style {
13            size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(10f32) },
14            ..Default::default()
15        })
16        .unwrap();
17    let node2 = taffy
18        .new_leaf(taffy::style::Style {
19            size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(10f32) },
20            ..Default::default()
21        })
22        .unwrap();
23    let node = taffy
24        .new_with_children(
25            taffy::style::Style {
26                flex_direction: taffy::style::FlexDirection::Column,
27                justify_content: Some(taffy::style::JustifyContent::FlexStart),
28                size: taffy::geometry::Size {
29                    width: taffy::style::Dimension::Points(100f32),
30                    height: taffy::style::Dimension::Points(100f32),
31                },
32                ..Default::default()
33            },
34            &[node0, node1, node2],
35        )
36        .unwrap();
37    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
38}