Questions tagged [refcell]
64 questions
-1
votes
1 answer
Rust pushing to vector with borrow_mut
Let's have a struct containing a vector of cities and a new_city function adding City to the vector. However, I got BorrowMutError which makes sense.
What should I do so I can call new_city multiple times (see below)?
I would need to drop the…

Filip Čermák
- 9
- 3
-1
votes
1 answer
Rust can't modify RefCell in Rc
I want to simulate some natural process, so I have a Simulator, and a reactor like a NuclearReactor. The simulator will modify the reactor, and the reactor can reversely influance the simulator by modifying it. One important thing is that the…

YNX
- 511
- 6
- 17
-1
votes
1 answer
How do I cast a concrete object in a Rc> to a dynamic trait object?
I have the struct MyText which implements the ModifyValue trait. MyText::new returns Rc>.
I want a struct Modifier that, given a jet of type Rc> (practically any dynamic object that implements the trait…

Giggi
- 681
- 2
- 9
- 17