gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 496HTML 245JavaScript 8CSS 61214 Definiciones

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

Strict types for style values (#269) 0d8c198a9 · Nico Burns ·

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