fn vertical_spacing(&self) -> Vec<f32> {
        let tokens = self.clone().into_iter();
        let mut tkns = tokens.peekable();

        let mut vertical_spacing = Vec::new();

        while let Some(current_token) = tkns.next() {
            if let Some(next_token) = tkns.peek() {
                let spacing = current_token.base();
                let last_spacing = *vertical_spacing.last().unwrap_or(&0.0);

                let mut v = Vec::with_capacity(1);
                v.push(*next_token);

                // Only take into account tokens on different lines
                match current_token.alignement(v) {
                    ObjectAlignement::HorizontalAligned
                    | ObjectAlignement::HorizontalCenterAligned => (),
                    _ => {
                        if spacing > 0.0 && spacing > last_spacing {
                            vertical_spacing.push(next_token.y() - spacing);
                        }
                    }
                }
            }
        }

        // removing empty spaces
        vertical_spacing = vertical_spacing
            .into_iter()
            .filter(|spacing| *spacing > 0.0)
            .collect::<Vec<f32>>();

        vertical_spacing.shrink_to_fit();
        vertical_spacing
    }
/// Collect vertical spacing of a set of tokens
Collect vertical spacing of a set of tokens
Collect vertical spacing of a set of tokens
fn vertical_spacing(&self) -> Vec<f32> {
        let tokens = self.clone().into_iter();
        let mut tkns = tokens.peekable();
        let mut vertical_spacing = Vec::new();
        while let Some(current_token) = tkns.next() {
            if let Some(next_token) = tkns.peek() {
                let spacing = current_token.base();
                let last_spacing = *vertical_spacing.last().unwrap_or(&0.0);
                let mut v = Vec::with_capacity(1);
                v.push(*next_token);
                // Only take into account tokens on different lines
                match current_token.alignement(v) {
                    ObjectAlignement::HorizontalAligned
                    | ObjectAlignement::HorizontalCenterAligned => (),
                    _ => {
                        if spacing > 0.0 && spacing > last_spacing {
                            vertical_spacing.push(next_token.y() - spacing);
                        }
                    }
                }
            }
        }
        // removing empty spaces
        vertical_spacing = vertical_spacing
            .into_iter()
            .filter(|spacing| *spacing > 0.0)
            .collect::<Vec<f32>>();
        vertical_spacing.shrink_to_fit();
        vertical_spacing
    }
fn vertical_spacing ( & self ) -> Vec < f32 > { let tokens = self . clone ( ) . into_iter ( ) ; let mut tkns = tokens . peekable ( ) ; let mut vertical_spacing = Vec :: new ( ) ; while let Some ( current_token ) = tkns . next ( ) { if let Some ( next_token ) = tkns . peek ( ) { let spacing = current_token . base ( ) ; let last_spacing = * vertical_spacing . last ( ) . unwrap_or ( & 0.0 ) ; let mut v = Vec :: with_capacity ( 1 ) ; v . push ( * next_token ) ; // Only take into account tokens on different lines match current_token . alignement ( v ) { ObjectAlignement :: HorizontalAligned | ObjectAlignement :: HorizontalCenterAligned => ( ) , _ => { if spacing > 0.0 && spacing > last_spacing { vertical_spacing . push ( next_token . y ( ) - spacing ) ; } } } } } // removing empty spaces vertical_spacing = vertical_spacing . into_iter ( ) . filter ( | spacing | * spacing > 0.0 ) . collect :: < Vec < f32 > > ( ) ; vertical_spacing . shrink_to_fit ( ) ; vertical_spacing }
Collect vertical spacing of a set of tokens
Collect vertical spacing of a set of tokens
&self