homo

Crates.iohomo
lib.rshomo
version0.0.1
sourcesrc
created_at2022-08-14 16:42:58.229122
updated_at2022-08-14 16:42:58.229122
descriptionLayout engine
homepagehttps://crates.io/crates/soga
repositoryhttps://github.com/yisar/soga
max_upload_size
id645487
size24,966
伊撒尔 (yisar)

documentation

https://github.com/yisar/soga

README

soga

Yoga alternative

Build Status crates.io crates.io license

Test

cargo test

Use

use soga::flexbox::FlexBox;
use soga::flexbox::FlexItem;
use std::convert::TryInto;

fn main() {
    let mut root = FlexItem::new(100, 100);

    let child1 = FlexItem::new(100, 50);
    let child2 = FlexItem::new(100, 50);

    root.add(child1);
    root.add(child2);

    let mut flexbox = FlexBox::new();
    flexbox.layout(&mut root);

    assert_eq!(root.children[0].frame, [0, 0, 100, 50]);
    assert_eq!(root.children[1].frame, [50, 0, 100, 50]);
}

License

MIT ©yisar inspired by yoga.

Commit count: 103

cargo fmt