tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 1085HTML 1017Markdown 12TOML 83230 Definitions

⎇ 2472941336f4a3a4b74d7a4330a2fe5c5c5c1428 examples/basic.rs Rust · 21 lines · 604 B History Who touched what raw

update sample to use new api 247294133 · Emil Sjölander ·

1use stretch::geometry::Size;
2use stretch::node::Node;
3use stretch::style::*;
4
5fn main() {
6    let node = Node::new(
7        Style {
8            size: Size { width: Dimension::Points(100.0), height: Dimension::Points(100.0) },
9            justify_content: JustifyContent::Center,
10            ..Default::default()
11        },
12        vec![&Node::new(
13            Style { size: Size { width: Dimension::Percent(0.5), height: Dimension::Auto }, ..Default::default() },
14            vec![],
15        )],
16    );
17
18    let layout = node.compute_layout(Size::undefined()).unwrap();
19
20    println!("{:#?}", layout);
21}