gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 227Rust 7TOML 3CSS 1307 Definiciones

⎇ 0.2.x benches/generated/margin_should_not_be_part_of_max_width.rs Rust · 35 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                size: taffy::geometry::Size {
7                    width: taffy::style::Dimension::Points(100f32),
8                    height: taffy::style::Dimension::Points(100f32),
9                    ..Default::default()
10                },
11                max_size: taffy::geometry::Size {
12                    width: taffy::style::Dimension::Points(100f32),
13                    ..Default::default()
14                },
15                margin: taffy::geometry::Rect { left: taffy::style::Dimension::Points(20f32), ..Default::default() },
16                ..Default::default()
17            },
18            &[],
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(250f32),
26                    height: taffy::style::Dimension::Points(250f32),
27                    ..Default::default()
28                },
29                ..Default::default()
30            },
31            &[node0],
32        )
33        .unwrap();
34    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
35}