⎇ d8c8bb472833ba92d694a9420e4c5bd8308e32e3
benches/generated/margin_auto_left.rs
Historia
Quién tocó qué
crudo
Strict types for style values (#269)
1pub fn compute() {
2 #[allow(unused_imports)]
3 use taffy::prelude::*;
4 let mut taffy = taffy::Taffy::new();
5 let node0 = taffy
6 .new_with_children(
7 taffy::style::Style {
8 size: taffy::geometry::Size {
9 width: taffy::style::Dimension::Points(50f32),
10 height: taffy::style::Dimension::Points(50f32),
11 ..Size::auto()
12 },
13 margin: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::Auto, ..Rect::zero() },
14 ..Default::default()
15 },
16 &[],
17 )
18 .unwrap();
19 let node1 = taffy
20 .new_with_children(
21 taffy::style::Style {
22 size: taffy::geometry::Size {
23 width: taffy::style::Dimension::Points(50f32),
24 height: taffy::style::Dimension::Points(50f32),
25 ..Size::auto()
26 },
27 ..Default::default()
28 },
29 &[],
30 )
31 .unwrap();
32 let node = taffy
33 .new_with_children(
34 taffy::style::Style {
35 align_items: taffy::style::AlignItems::Center,
36 size: taffy::geometry::Size {
37 width: taffy::style::Dimension::Points(200f32),
38 height: taffy::style::Dimension::Points(200f32),
39 ..Size::auto()
40 },
41 ..Default::default()
42 },
43 &[node0, node1],
44 )
45 .unwrap();
46 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
47}