I implemented a simple binary search tree in Rust (after CIS 198, this is great), and for training I do iterators that just run right edges.
I could not implement an iterator that gives mutable links. I tried many ways, but no one accepted the Rust compiler. The code I need help in is below ( while I did the gist with the full code here ):
#[derive(Debug)] pub struct Tree<T>(Option<Box<Node<T>>>); #[derive(Debug)] pub struct Node<T> { elem: T, left: Tree<T>, right: Tree<T>, }
source share