gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 229Rust 8TOML 3CSS 1310 Sutichaykuna

⎇ 54e00d63d6d4a99e89ac0934a6bb61e415ab1006 examples/basic.rs Rust · 21 siq'ikuna · 604 B Ñawpa willay Pi imata llamkarqan ch'uya

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}