tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 788HTML 740Markdown 12TOML 62536 Definitions

⎇ ec371711989b7f4d870d91bea4b66bdd94b45c9e benches/generated/absolute_layout_width_height_end_bottom.rs Rust · 34 lines · 1.2 KB History Who touched what raw

Rename PositionType and Position in accordance to specs (#295) e2cee9d6f · Andreas Weibye ·

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            position: taffy::style::Position::Absolute,
8            size: taffy::geometry::Size {
9                width: taffy::style::Dimension::Points(10f32),
10                height: taffy::style::Dimension::Points(10f32),
11            },
12            inset: taffy::geometry::Rect {
13                left: auto(),
14                right: taffy::style::LengthPercentageAuto::Points(10f32),
15                top: auto(),
16                bottom: taffy::style::LengthPercentageAuto::Points(10f32),
17            },
18            ..Default::default()
19        })
20        .unwrap();
21    let node = taffy
22        .new_with_children(
23            taffy::style::Style {
24                size: taffy::geometry::Size {
25                    width: taffy::style::Dimension::Points(100f32),
26                    height: taffy::style::Dimension::Points(100f32),
27                },
28                ..Default::default()
29            },
30            &[node0],
31        )
32        .unwrap();
33    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
34}