You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: tree_iter.rs
    path of file: ./repos/vizia/crates/vizia_storage/src/tree/iter
    
    the code of the file until where you have to start completion: use crate::{DoubleEndedTreeTour, TourDirection, TourStep, Tree};
use vizia_id::GenerationalId;

/// Iterator for iterating through the tree in depth first preorder.
pub struct TreeIterator<'a, I>
where
    I: GenerationalId,
{
    tree: &'a Tree<I>,
    tours: DoubleEndedTreeTour<I>,
}

impl<'a, I> TreeIterator<'a, I>
where
    I: GenerationalId,
{
    pub fn new(tree: &'a Tree<I>, tours: DoubleEndedTreeTour<I>) -> Self {
        Self { tree, tours }
    }

    pub fn full(tree: &'a Tree<I>) -> Self {
        Self::subtree(tree, I::root())
    }

    pub fn subtree(tree: &'a Tree<I>, root: I) -> Self {
        Self { tree, tours: DoubleEndedTreeTour::new_same(Some(root)) }
    }
}

i
    
    fn simple_forward_backward() -> Result<(), TreeError> {
        let mut t = Tree::new();
        let r = Entity::root();
        let [a, b, c, d, e] = [1, 2, 3, 4, 5].map(|i| Entity::new(i, 0));
        t.add(a, r)?;
        t.add(b, r)?;
        t.add(c, a)?;
        t.add(d, a)?;
        t.add(e, b)?;
        let correct = [r, a, c, d, b, e];
        let forward = TreeIterator::full(&t);
        let backward = TreeIterator::full(&t).rev();
        assert!(forward.eq(correct.iter().cloned()));
        assert!(backward.eq(correct.iter().cloned().rev()));

        // correct DoubleEndedIterator behavior, each item yielded only once
        let mut double = TreeIterator::full(&t);
        let mut front = Vec::new();
        let mut back = Vec::new();
        loop {
            if let Some(x) = double.next() {
                front.push(x);
            }
            if let Some(x) = double.next_back() {
                back.push(x);
            } else {
                break;
            }
        }
        back.reverse();
        front.append(&mut back);
        assert!(front.iter().eq(correct.iter()));

        let correct = [a, c, d];
        let forward = TreeIterator::subtree(&t, a);
        let backward = TreeIterator::subtree(&t, a).rev();
        assert!(forward.eq(correct.iter().cloned()));
        assert!(backward.eq(correct.iter().cloned().rev()));
        Ok(())
    }