gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 227Rust 7TOML 3CSS 1307 Definiciones

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

Rename FlexboxLayout back to Style (#251) 49893a7d9 · Nico Burns ·

1pub fn compute() {
2    let mut taffy = taffy::Taffy::new();
3    let node00 = taffy
4        .new_with_children(
5            taffy::style::Style {
6                flex_grow: 1f32,
7                size: taffy::geometry::Size { height: taffy::style::Dimension::Points(20f32), ..Default::default() },
8                ..Default::default()
9            },
10            &[],
11        )
12        .unwrap();
13    let node0 = taffy
14        .new_with_children(
15            taffy::style::Style {
16                max_size: taffy::geometry::Size {
17                    width: taffy::style::Dimension::Points(100f32),
18                    ..Default::default()
19                },
20                ..Default::default()
21            },
22            &[node00],
23        )
24        .unwrap();
25    let node = taffy
26        .new_with_children(
27            taffy::style::Style {
28                flex_direction: taffy::style::FlexDirection::Column,
29                size: taffy::geometry::Size {
30                    width: taffy::style::Dimension::Points(200f32),
31                    height: taffy::style::Dimension::Points(100f32),
32                    ..Default::default()
33                },
34                ..Default::default()
35            },
36            &[node0],
37        )
38        .unwrap();
39    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
40}