gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81414 Definiciones

⎇ b91874d4e34ecc9054b468a338ffcae6f61a1b4a benches/generated/align_self_baseline.rs Rust · 50 líneas · 1.7 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            align_self: Some(taffy::style::AlignSelf::Baseline),
8            size: taffy::geometry::Size {
9                width: taffy::style::Dimension::Points(50f32),
10                height: taffy::style::Dimension::Points(50f32),
11            },
12            ..Default::default()
13        })
14        .unwrap();
15    let node10 = taffy
16        .new_leaf(taffy::style::Style {
17            size: taffy::geometry::Size {
18                width: taffy::style::Dimension::Points(50f32),
19                height: taffy::style::Dimension::Points(10f32),
20            },
21            ..Default::default()
22        })
23        .unwrap();
24    let node1 = taffy
25        .new_with_children(
26            taffy::style::Style {
27                align_self: Some(taffy::style::AlignSelf::Baseline),
28                size: taffy::geometry::Size {
29                    width: taffy::style::Dimension::Points(50f32),
30                    height: taffy::style::Dimension::Points(20f32),
31                },
32                ..Default::default()
33            },
34            &[node10],
35        )
36        .unwrap();
37    let node = taffy
38        .new_with_children(
39            taffy::style::Style {
40                size: taffy::geometry::Size {
41                    width: taffy::style::Dimension::Points(100f32),
42                    height: taffy::style::Dimension::Points(100f32),
43                },
44                ..Default::default()
45            },
46            &[node0, node1],
47        )
48        .unwrap();
49    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
50}