tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 227Rust 7TOML 3CSS 1307 Definiciones

⎇ ec371711989b7f4d870d91bea4b66bdd94b45c9e benches/generated/justify_content_row_min_width_and_margin.rs Rust · 31 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            size: taffy::geometry::Size {
8                width: taffy::style::Dimension::Points(20f32),
9                height: taffy::style::Dimension::Points(20f32),
10            },
11            margin: taffy::geometry::Rect {
12                left: taffy::style::LengthPercentageAuto::Points(10f32),
13                right: zero(),
14                top: zero(),
15                bottom: zero(),
16            },
17            ..Default::default()
18        })
19        .unwrap();
20    let node = taffy
21        .new_with_children(
22            taffy::style::Style {
23                justify_content: Some(taffy::style::JustifyContent::Center),
24                min_size: taffy::geometry::Size { width: taffy::style::Dimension::Points(50f32), height: auto() },
25                ..Default::default()
26            },
27            &[node0],
28        )
29        .unwrap();
30    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
31}