tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 1076HTML 1008Markdown 12TOML 83208 Definitions

⎇ c5fb0ccd1e33a1ce33dba252f06315d4f8a21d28 examples/basic.rs Rust · 23 lines · 675 B History Who touched what raw

use geometry in styles c098afe70 · Emil Sjölander ·

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