gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 227Rust 7TOML 3CSS 1307 Definiciones

⎇ e6897f82f7b6a182d27aa52964d4bcbdaef97c13 examples/basic.rs Rust · 21 líneas · 604 B Historia Quién tocó qué crudo

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}