gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81414 Definiciones

⎇ b91874d4e34ecc9054b468a338ffcae6f61a1b4a benches/generated/flex_grow_within_constrained_max_column.rs Rust · 30 líneas · 1.1 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 node0 = taffy
6        .new_leaf(taffy::style::Style {
7            flex_shrink: 1f32,
8            flex_basis: taffy::style::Dimension::Points(100f32),
9            ..Default::default()
10        })
11        .unwrap();
12    let node1 = taffy
13        .new_leaf(taffy::style::Style {
14            size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(50f32) },
15            ..Default::default()
16        })
17        .unwrap();
18    let node = taffy
19        .new_with_children(
20            taffy::style::Style {
21                flex_direction: taffy::style::FlexDirection::Column,
22                size: taffy::geometry::Size { width: taffy::style::Dimension::Points(100f32), height: auto() },
23                max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(100f32) },
24                ..Default::default()
25            },
26            &[node0, node1],
27        )
28        .unwrap();
29    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
30}