Crates.io | homo |
lib.rs | homo |
version | 0.0.1 |
source | src |
created_at | 2022-08-14 16:42:58.229122 |
updated_at | 2022-08-14 16:42:58.229122 |
description | Layout engine |
homepage | https://crates.io/crates/soga |
repository | https://github.com/yisar/soga |
max_upload_size | |
id | 645487 |
size | 24,966 |
Yoga alternative
cargo test
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]);
}
MIT ©yisar inspired by yoga.