tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 499HTML 238Markdown 7TOML 31234 Definiciones

⎇ ebd376fbebd0ba73c79aa00d1835918680ef82a0 benches/generated/flex_grow_within_constrained_max_width.rs Rust · 35 líneas · 1.2 KB Historia Quién tocó qué crudo

Implement CSS Grid (#205) 6fd2c6bcb · 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_leaf(taffy::style::Style {
7            flex_grow: 1f32,
8            size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(20f32) },
9            ..Default::default()
10        })
11        .unwrap();
12    let node0 = taffy
13        .new_with_children(
14            taffy::style::Style {
15                max_size: taffy::geometry::Size { width: taffy::style::Dimension::Points(300f32), height: auto() },
16                ..Default::default()
17            },
18            &[node00],
19        )
20        .unwrap();
21    let node = taffy
22        .new_with_children(
23            taffy::style::Style {
24                flex_direction: taffy::style::FlexDirection::Column,
25                size: taffy::geometry::Size {
26                    width: taffy::style::Dimension::Points(200f32),
27                    height: taffy::style::Dimension::Points(100f32),
28                },
29                ..Default::default()
30            },
31            &[node0],
32        )
33        .unwrap();
34    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
35}