How to make mutable pointer to field of node of tree and mutate it? [duplicate]
问题 This question already has answers here : Cannot obtain a mutable reference when iterating a recursive structure: cannot borrow as mutable more than once at a time (4 answers) Closed last year . I want to find some node in the tree and I need a pointer to the container of nodes: &mut Vec<Node> struct Node { c: Vec<Node>, v: i32, } impl Node { pub fn new(u: i32, n: Node) -> Node { let mut no = Node { c: Vec::new(), v: u, }; no.c.push(n); no } } fn main() { let mut a = Node::new(1, Node::new(2,