tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81412 Definiciones

⎇ 0.2.x benches/generated/absolute_layout_width_height_start_top_end_bottom.rs Rust · 38 líneas · 1.4 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                    right: taffy::style::Dimension::Points(10f32),
15                    top: taffy::style::Dimension::Points(10f32),
16                    bottom: taffy::style::Dimension::Points(10f32),
17                    ..Default::default()
18                },
19                ..Default::default()
20            },
21            &[],
22        )
23        .unwrap();
24    let node = taffy
25        .new_with_children(
26            taffy::style::Style {
27                size: taffy::geometry::Size {
28                    width: taffy::style::Dimension::Points(100f32),
29                    height: taffy::style::Dimension::Points(100f32),
30                    ..Default::default()
31                },
32                ..Default::default()
33            },
34            &[node0],
35        )
36        .unwrap();
37    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
38}