tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

⎇ 4e1c35c5d40729fdaafc40afeea863aa12ed1d5a benches/generated/margin_with_sibling_row.rs Rust · 31 siq'ikuna · 1.0 KB Ñawpa willay Pi imata llamkarqan ch'uya

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_grow: 1f32,
8            margin: taffy::geometry::Rect {
9                left: zero(),
10                right: taffy::style::LengthPercentageAuto::Points(10f32),
11                top: zero(),
12                bottom: zero(),
13            },
14            ..Default::default()
15        })
16        .unwrap();
17    let node1 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap();
18    let node = taffy
19        .new_with_children(
20            taffy::style::Style {
21                size: taffy::geometry::Size {
22                    width: taffy::style::Dimension::Points(100f32),
23                    height: taffy::style::Dimension::Points(100f32),
24                },
25                ..Default::default()
26            },
27            &[node0, node1],
28        )
29        .unwrap();
30    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
31}