fn eq(&self, other: &Tree<T>) -> bool {
        if self.data != other.data {
            return false;
        } else if !self.siblings.is_empty() || !other.siblings.is_empty() {
            let mut stack1 = self.siblings.clone();
            let mut stack2 = other.siblings.clone();

            while let Some(left) = stack1.pop() {
                if let Some(right) = stack2.pop() {
                    let left = left.borrow();
                    let right = right.borrow();
                    if left.data != right.data {
                        return false;
                    }
                    if left.siblings.len() == right.siblings.len() {
                        stack1.extend_from_slice(&left.siblings);
                        stack2.extend_from_slice(&right.siblings);
                    } else {
                        return false;
                    }
                } else {
                    return false;
                }
            }
        }
        true
    }
/// Compare trees.
///
/// Compares tree values and all subtrees from one tree with another.
///
/// # Examples
///
/// ```
/// let root1 = Tree::new(0);
/// Tree::push_child(&root1, 1);
/// Tree::push_child(&root1, 2);
///
/// let root2 = Tree::new(0);
/// Tree::push_child(&root2, 1);
/// Tree::push_child(&root2, 2);
///
/// assert_eq!(root1, root2);
///
/// Tree::push_child(&root2, 3);
/// assert_ne!(root1, root2);
/// ```
///
Compare trees.
Compares tree values and all subtrees from one tree with another.
Compare trees . Compares tree values and all subtrees from one tree with another .
fn eq(&self, other: &Tree<T>) -> bool {
        if self.data != other.data {
            return false;
        } else if !self.siblings.is_empty() || !other.siblings.is_empty() {
            let mut stack1 = self.siblings.clone();
            let mut stack2 = other.siblings.clone();
            while let Some(left) = stack1.pop() {
                if let Some(right) = stack2.pop() {
                    let left = left.borrow();
                    let right = right.borrow();
                    if left.data != right.data {
                        return false;
                    }
                    if left.siblings.len() == right.siblings.len() {
                        stack1.extend_from_slice(&left.siblings);
                        stack2.extend_from_slice(&right.siblings);
                    } else {
                        return false;
                    }
                } else {
                    return false;
                }
            }
        }
        true
    }
fn eq ( & self , other : & Tree < T > ) -> bool { if self . data != other . data { return false ; } else if ! self . siblings . is_empty ( ) || ! other . siblings . is_empty ( ) { let mut stack1 = self . siblings . clone ( ) ; let mut stack2 = other . siblings . clone ( ) ; while let Some ( left ) = stack1 . pop ( ) { if let Some ( right ) = stack2 . pop ( ) { let left = left . borrow ( ) ; let right = right . borrow ( ) ; if left . data != right . data { return false ; } if left . siblings . len ( ) == right . siblings . len ( ) { stack1 . extend_from_slice ( & left . siblings ) ; stack2 . extend_from_slice ( & right . siblings ) ; } else { return false ; } } else { return false ; } } } true }
Compare trees.
Compare trees .
&self
other
&Tree<T>
examples
None