← All notes

Rc and RefCell interior mutability

Answer: Rc means reference counting: Rc<T> tracks how many handles point at a value. Some structures need multiple owners for one value.

Interior mutability

RefCell<T> checks borrow rules at runtime. Interior mutability lets you mutate data behind what looks like an immutable reference.

Rc supports multiple ownership by counting references.

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources and notices: The Rust Programming Language book (rust-lang/book): Copyright (c) 2010 The Rust Project Developers; MIT OR Apache-2.0, used under MIT (https://github.com/rust-lang/book/blob/main/LICENSE-MIT). Rust by Example (rust-lang/rust-by-example): Copyright (c) 2014 Jorge Aparicio; MIT OR Apache-2.0, used under MIT (https://github.com/rust-lang/rust-by-example/blob/master/LICENSE-MIT). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Rust book + Rust by Example Rc page (MIT OR Apache-2.0). Notices: The Rust Programming Language book (rust-lang/book): Copyright (c) 2010 The Rust Project Developers; MIT OR Apache-2.0, used under MIT (https://github.com/rust-lang/book/blob/main/LICENSE-MIT). Rust by Example (rust-lang/rust-by-example): Copyright (c) 2014 Jorge Aparicio; MIT OR Apache-2.0, used under MIT (https://github.com/rust-lang/rust-by-example/blob/master/LICENSE-MIT).

Cite this

Permanent ID: iil:note:69q9jwwr

iinventedlight. 2026. "Rc and RefCell interior mutability." iinventedlight Library, iil:note:69q9jwwr, version of 2026-11-09. https://iinventedlight.com/library/notes/rust-rc-refcell/. License: CC-BY-4.0.

@misc{iil_note_69q9jwwr,
  author = {{iinventedlight}},
  title = {{Rc and RefCell interior mutability}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-09},
  url = {https://iinventedlight.com/library/notes/rust-rc-refcell/},
  note = {Permanent ID iil:note:69q9jwwr. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/rust-rc-refcell.md.