Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

55
vendor/taffy/examples/nested.rs vendored Normal file
View File

@@ -0,0 +1,55 @@
use taffy::prelude::*;
fn main() -> Result<(), taffy::TaffyError> {
let mut taffy: TaffyTree<()> = TaffyTree::new();
// left
let child_t1 = taffy.new_leaf(Style {
size: Size { width: Dimension::Length(5.0), height: Dimension::Length(5.0) },
..Default::default()
})?;
let div1 = taffy.new_with_children(
Style {
size: Size { width: Dimension::Percent(0.5), height: Dimension::Percent(1.0) },
// justify_content: JustifyContent::Center,
..Default::default()
},
&[child_t1],
)?;
// right
let child_t2 = taffy.new_leaf(Style {
size: Size { width: Dimension::Length(5.0), height: Dimension::Length(5.0) },
..Default::default()
})?;
let div2 = taffy.new_with_children(
Style {
size: Size { width: Dimension::Percent(0.5), height: Dimension::Percent(1.0) },
// justify_content: JustifyContent::Center,
..Default::default()
},
&[child_t2],
)?;
let container = taffy.new_with_children(
Style { size: Size { width: Dimension::Percent(1.0), height: Dimension::Percent(1.0) }, ..Default::default() },
&[div1, div2],
)?;
taffy.compute_layout(
container,
Size { height: AvailableSpace::Definite(100.0), width: AvailableSpace::Definite(100.0) },
)?;
println!("node: {:#?}", taffy.layout(container)?);
println!("div1: {:#?}", taffy.layout(div1)?);
println!("div2: {:#?}", taffy.layout(div2)?);
println!("child1: {:#?}", taffy.layout(child_t1)?);
println!("child2: {:#?}", taffy.layout(child_t2)?);
Ok(())
}