tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 231Rust 10TOML 3CSS 1348 Definiciones

⎇ 0.2.x benches/generated/absolute_layout_width_height_start_top.rs Rust · 36 líneas · 1.3 KB Historia Quién tocó qué crudo

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