In Rust document, Cell is “A mutable memory location”, and RefCell is “A mutable memory location with dynamically checked borrow rules”.
They both provide “interior mutability”, where you can modify the value stored in cell via immutable reference of the cell.
They both have an API get_mut to return a mutable reference to the underlying data. This method requires a mutable reference to the cell, which guarantees that the callee has exclusive ownership of the cell.
pub fn get_mut(&mut self) -> &mut T The difference is how they implement interior mutability. Cell copies or moves contained value, while RefCell allows both mutable and immutable reference borrowing. I will try to explain the difference via their APIs in this article.