Attempting to implement a Tree using Rust

References are meant to be temporary, and until you are familiar with the borrow checker, treat them that way. Don't use references here, use Box because the nodes need to be long lived.

struct Node {
    value: i8,
    lhs: Option<Box<Node>>,
    rhs: Option<Box<Node>>,
}
2 Likes