Graph and multithread


I want to implement a graph with multithread. This is a possible beginning
I choose the type


I would like to know if there is a better alternative.
I need the graph fully mutate graph and a node can exist independently.
A node have multple reader and one writer.
I didn’t find a alternative to Rc<RefCell<Node>>



The analog to Rc<RefCell<Node>> is Arc<RwLock<Node>>, not RwLock<Arc<Node>>.

Single thread | Multi thread
Rc            | Arc
RefCell       | RwLock / Mutex


Thanks. I have this code


The borrow checker is just getting confused; the following works:

        let x =;
        let x = x.list[0].read().unwrap();
        println!(" {}", *;