Glossary coding Term Page

RefCell<T>

A runtime borrow-checking type for interior mutability

refcell #rust#memory#interior-mutability
Korean version

Aliases

RefCellruntime borrow checking

Prerequisites

Related Concepts

Core Idea

[[refcell|RefCell<T>]] is the Rust type that enforces borrowing rules at runtime instead of compile time. Even when you hold only an immutable outer reference, the inner value can still be mutated, but any rule violation triggers a panic.

Why It Matters Here

Mathbong uses RefCell for the Rc<RefCell<T>> pattern, GUI-like trees, graph structures, and interior mutability in practice. It shows what flexibility you gain when the compiler no longer catches every borrow conflict up front.

Posts Mentioning This Concept