fn build_child_nodes(children: &Vec<FlexboxLayoutChild>, stretch: &mut Stretch) -> Result<(usize, Vec<Node>), stretch::Error> {
        let mut nodes = Vec::new();
        let mut item_count = 0;

        for child in children.iter() {
            match child {
                FlexboxLayoutChild::Item(child) =>{
                    nodes.push(stretch.new_node(child.style, Vec::new())?);
                    item_count += 1;
                },
                FlexboxLayoutChild::Flexbox(child) => {
                    let (child_count, child_nodes) = FlexboxLayout::build_child_nodes(child.children().children(), stretch)?;
                    nodes.push(stretch.new_node(child.style(), child_nodes)?);
                    item_count += child_count;
                },
            };
        }

        Ok((item_count, nodes))
    }
// Utility function to compile tree of children nodes for layout purposes
// Also returns the total number of children items to allow cleaner deferred positioning
Utility function to compile tree of children nodes for layout purposes
Also returns the total number of children items to allow cleaner deferred positioning
Utility function to compile tree of children nodes for layout purposes Also returns the total number of children items to allow cleaner deferred positioning
fn build_child_nodes(children: &Vec<FlexboxLayoutChild>, stretch: &mut Stretch) -> Result<(usize, Vec<Node>), stretch::Error> {
        let mut nodes = Vec::new();
        let mut item_count = 0;
        for child in children.iter() {
            match child {
                FlexboxLayoutChild::Item(child) =>{
                    nodes.push(stretch.new_node(child.style, Vec::new())?);
                    item_count += 1;
                },
                FlexboxLayoutChild::Flexbox(child) => {
                    let (child_count, child_nodes) = FlexboxLayout::build_child_nodes(child.children().children(), stretch)?;
                    nodes.push(stretch.new_node(child.style(), child_nodes)?);
                    item_count += child_count;
                },
            };
        }
        Ok((item_count, nodes))
    }
fn build_child_nodes ( children : & Vec < FlexboxLayoutChild > , stretch : & mut Stretch ) -> Result < ( usize , Vec < Node > ) , stretch :: Error > { let mut nodes = Vec :: new ( ) ; let mut item_count = 0 ; for child in children . iter ( ) { match child { FlexboxLayoutChild :: Item ( child ) => { nodes . push ( stretch . new_node ( child . style , Vec :: new ( ) ) ? ) ; item_count += 1 ; } , FlexboxLayoutChild :: Flexbox ( child ) => { let ( child_count , child_nodes ) = FlexboxLayout :: build_child_nodes ( child . children ( ) . children ( ) , stretch ) ? ; nodes . push ( stretch . new_node ( child . style ( ) , child_nodes ) ? ) ; item_count += child_count ; } , } ; } Ok ( ( item_count , nodes ) ) }
Utility function to compile tree of children nodes for layout purposes
Also returns the total number of children items to allow cleaner deferred positioning
Utility function to compile tree of children nodes for layout purposes Also returns the total number of children items to allow cleaner deferred positioning
children
&Vec<FlexboxLayoutChild>
stretch
&mut Stretch