tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 707HTML 660Markdown 12TOML 62344 Definitions

⎇ b91874d4e34ecc9054b468a338ffcae6f61a1b4a benches/generated/display_none_with_position.rs Rust · 32 lines · 1.1 KB History Who touched what raw

Rename PositionType and Position in accordance to specs (#295) e2cee9d6f · Andreas Weibye ·

1pub fn compute() {
2    #[allow(unused_imports)]
3    use taffy::prelude::*;
4    let mut taffy = taffy::Taffy::new();
5    let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap();
6    let node1 = taffy
7        .new_leaf(taffy::style::Style {
8            display: taffy::style::Display::None,
9            flex_grow: 1f32,
10            inset: taffy::geometry::Rect {
11                left: auto(),
12                right: auto(),
13                top: taffy::style::LengthPercentageAuto::Points(10f32),
14                bottom: auto(),
15            },
16            ..Default::default()
17        })
18        .unwrap();
19    let node = taffy
20        .new_with_children(
21            taffy::style::Style {
22                size: taffy::geometry::Size {
23                    width: taffy::style::Dimension::Points(100f32),
24                    height: taffy::style::Dimension::Points(100f32),
25                },
26                ..Default::default()
27            },
28            &[node0, node1],
29        )
30        .unwrap();
31    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
32}