fn compare_iter(
        mut iter: Peekable<Iter<VersionPart<'a>>>,
        mut other_iter: Peekable<Iter<VersionPart<'a>>>,
    ) -> CompOp {
        // Iterate through the parts of this version
        let mut other_part: Option<&VersionPart>;

        // Iterate over the iterator, without consuming it
        loop {
            match iter.next() {
                Some(part) => {
                    // Get the part for the other version
                    other_part = other_iter.next();

                    // If there are no parts left in the other version, try to determine the result
                    if other_part.is_none() {
                        // In the main version: if the current part is zero, continue to the next one
                        match part {
                            &VersionPart::Number(num) => {
                                if num == 0 {
                                    continue;
                                }
                            }
                            &VersionPart::Text(_) => return CompOp::Lt,
                        }

                        // The main version is greater
                        return CompOp::Gt;
                    }

                    // Match both part as numbers to destruct their numerical values
                    match part {
                        &VersionPart::Number(num) => match other_part.unwrap() {
                            &VersionPart::Number(other_num) => {
                                // Compare the numbers
                                match num {
                                    n if n < other_num => return CompOp::Lt,
                                    n if n > other_num => return CompOp::Gt,
                                    _ => continue,
                                }
                            }
                            _ => {}
                        },
                        _ => {}
                    }
                }
                None => break,
            }
        }

        // Check whether we should iterate over the other iterator, if it has any items left
        match other_iter.peek() {
            // Compare based on the other iterator
            Some(_) => Self::compare_iter(other_iter, iter).as_flipped(),

            // Nothing more to iterate over, the versions should be equal
            None => CompOp::Eq,
        }
    }
/// Compare two version numbers based on the iterators of their version parts.
///
/// This method returns one of the following comparison operators:
///
/// * `Lt`
/// * `Eq`
/// * `Gt`
///
/// Other comparison operators can be used when comparing, but aren't returned by this method.
Compare two version numbers based on the iterators of their version parts.
This method returns one of the following comparison operators.



Other comparison operators can be used when comparing, but aren't returned by this method.
Compare two version numbers based on the iterators of their version parts . This method returns one of the following comparison operators . Other comparison operators can be used when comparing but aren ' t returned by this method .
fn compare_iter(
        mut iter: Peekable<Iter<VersionPart<'a>>>,
        mut other_iter: Peekable<Iter<VersionPart<'a>>>,
    ) -> CompOp {
        // Iterate through the parts of this version
        let mut other_part: Option<&VersionPart>;
        // Iterate over the iterator, without consuming it
        loop {
            match iter.next() {
                Some(part) => {
                    // Get the part for the other version
                    other_part = other_iter.next();
                    // If there are no parts left in the other version, try to determine the result
                    if other_part.is_none() {
                        // In the main version: if the current part is zero, continue to the next one
                        match part {
                            &VersionPart::Number(num) => {
                                if num == 0 {
                                    continue;
                                }
                            }
                            &VersionPart::Text(_) => return CompOp::Lt,
                        }
                        // The main version is greater
                        return CompOp::Gt;
                    }
                    // Match both part as numbers to destruct their numerical values
                    match part {
                        &VersionPart::Number(num) => match other_part.unwrap() {
                            &VersionPart::Number(other_num) => {
                                // Compare the numbers
                                match num {
                                    n if n < other_num => return CompOp::Lt,
                                    n if n > other_num => return CompOp::Gt,
                                    _ => continue,
                                }
                            }
                            _ => {}
                        },
                        _ => {}
                    }
                }
                None => break,
            }
        }
        // Check whether we should iterate over the other iterator, if it has any items left
        match other_iter.peek() {
            // Compare based on the other iterator
            Some(_) => Self::compare_iter(other_iter, iter).as_flipped(),
            // Nothing more to iterate over, the versions should be equal
            None => CompOp::Eq,
        }
    }
fn compare_iter ( mut iter : Peekable < Iter < VersionPart < ' a > > > , mut other_iter : Peekable < Iter < VersionPart < ' a > > > , ) -> CompOp { // Iterate through the parts of this version let mut other_part : Option < & VersionPart > ; // Iterate over the iterator, without consuming it loop { match iter . next ( ) { Some ( part ) => { // Get the part for the other version other_part = other_iter . next ( ) ; // If there are no parts left in the other version, try to determine the result if other_part . is_none ( ) { // In the main version: if the current part is zero, continue to the next one match part { & VersionPart :: Number ( num ) => { if num == 0 { continue ; } } & VersionPart :: Text ( _ ) => return CompOp :: Lt , } // The main version is greater return CompOp :: Gt ; } // Match both part as numbers to destruct their numerical values match part { & VersionPart :: Number ( num ) => match other_part . unwrap ( ) { & VersionPart :: Number ( other_num ) => { // Compare the numbers match num { n if n < other_num => return CompOp :: Lt , n if n > other_num => return CompOp :: Gt , _ => continue , } } _ => { } } , _ => { } } } None => break , } } // Check whether we should iterate over the other iterator, if it has any items left match other_iter . peek ( ) { // Compare based on the other iterator Some ( _ ) => Self :: compare_iter ( other_iter , iter ) . as_flipped ( ) , // Nothing more to iterate over, the versions should be equal None => CompOp :: Eq , } }
Compare two version numbers based on the iterators of their version parts.
Compare two version numbers based on the iterators of their version parts .
iter
Peekable<Iter<VersionPart<'a>>>
other_iter
Peekable<Iter<VersionPart<'a>>>
iter
Peekable<Iter<VersionPart<'a>>>
other_iter
Peekable<Iter<VersionPart<'a>>>