tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 5544Rust 88Markdown 11TOML 91926 Definiciones

⎇ 4f43428b5e387dafa19cbcc0c5217fc8e61d0ce6 benches/generated/measure_child_absolute.rs Rust · 27 líneas · 1.0 KB Historia Quién tocó qué crudo

Grid/width depends on height tests (#300) 4f43428b5 · 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_with_measure(
7            taffy::style::Style { position: taffy::style::Position::Absolute, ..Default::default() },
8            taffy::node::MeasureFunc::Raw(|known_dimensions, available_space| {
9                const TEXT: &str = "HHHHHH";
10                super::measure_standard_text(known_dimensions, available_space, TEXT, super::WritingMode::Horizontal)
11            }),
12        )
13        .unwrap();
14    let node = taffy
15        .new_with_children(
16            taffy::style::Style {
17                size: taffy::geometry::Size {
18                    width: taffy::style::Dimension::Points(100f32),
19                    height: taffy::style::Dimension::Points(100f32),
20                },
21                ..Default::default()
22            },
23            &[node0],
24        )
25        .unwrap();
26    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
27}