⎇ d8c8bb472833ba92d694a9420e4c5bd8308e32e3
benches/generated/padding_align_end_child.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(100f32),
10 height: taffy::style::Dimension::Points(100f32),
11 ..Size::auto()
12 },
13 padding: taffy::geometry::Rect {
14 left: taffy::style::LengthPercentage::Points(20f32),
15 right: taffy::style::LengthPercentage::Points(20f32),
16 top: taffy::style::LengthPercentage::Points(20f32),
17 bottom: taffy::style::LengthPercentage::Points(20f32),
18 ..Rect::zero()
19 },
20 ..Default::default()
21 },
22 &[],
23 )
24 .unwrap();
25 let node = taffy
26 .new_with_children(
27 taffy::style::Style {
28 align_items: taffy::style::AlignItems::FlexEnd,
29 justify_content: taffy::style::JustifyContent::FlexEnd,
30 size: taffy::geometry::Size {
31 width: taffy::style::Dimension::Points(200f32),
32 height: taffy::style::Dimension::Points(200f32),
33 ..Size::auto()
34 },
35 ..Default::default()
36 },
37 &[node0],
38 )
39 .unwrap();
40 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
41}