tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 1085HTML 1017Markdown 12TOML 83230 Definitions

⎇ ca514f6c8ddc2a934f97170227bbe109223c80b8 benches/generated/absolute_layout_start_top_end_bottom.rs Rust · 33 lines · 1.2 KB History Who touched what raw

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