Glossary coding Term Page

Interior Mutability

A Rust pattern for mutation behind an immutable outer reference

interior-mutability #rust#memory#borrowing
Korean version

Aliases

interior mutabilityinner mutability

Prerequisites

Related Concepts

Core Idea

Interior mutability is the Rust pattern that allows inner values to change even when the outer reference looks immutable. In single-threaded code this often appears through [[refcell|RefCell<T>]], while multi-threaded code uses tools such as [[mutex|Mutex<T>]].

Why It Matters Here

Mathbong uses interior mutability whenever shared ownership and state changes must coexist. It is best understood not as a broken ownership rule, but as a different way of expressing the rule safely.

Posts Mentioning This Concept