Reference
An immutable Rust reference is a non-owning borrow that provides read-only access to a value without taking ownership of it.
Learn Rust in a Month of Lunches
An immutable reference is a Rust reference through which the referent cannot be modified and which can coexist with other immutable references.
- How it is used
- Uses immutable references to let multiple parts of a program view shared data without modifying it.
- How deep it goes
- Explains sharing rules, mixed-borrow errors, and compiler reasoning about when a mutable borrow ends.
- Examples
- Uses a presentation analogy, a shared-viewer scenario, and Rust code that triggers and then avoids a borrow conflict.
- What you can do after
- Evaluate borrow arrangements and reorder operations to avoid conflicting mutable and immutable references.
Read how Learn Rust in a Month of Lunches explains reference →
Refactoring to Rust
An immutable reference is a Rust non-owning reference that permits access to a value without modifying it through that reference.
- How it is used
- Uses borrowing to let functions inspect values without taking ownership or repeatedly creating and destroying them.
- How deep it goes
- Explains &T, borrowing rules, scope, and the contrast with &mut T through small artwork programs.
- Examples
- Demonstrates repeated artwork admiration and contrasts it with a mutable view counter.
- What you can do after
- Apply immutable references by changing owned parameters to &T and passing borrowed values without moving them.
Code Like a Pro in Rust
An immutable reference is a read-only reference through which the referenced value cannot be modified.
- How it is used
- Uses immutable references for shared read-only access while enforcing memory safety at compile time.
- How deep it goes
- Explains reference exclusivity, scope checking, and copy-related signatures, stopping short of exhaustive language-reference treatment.
- Examples
- Demonstrates string slices, lowercase conversion, owned strings, and in-place ASCII mutation.
- What you can do after
- Diagnose likely copying and mutation behavior by reading Rust function inputs and outputs, then verify uncertain cases in source.
Related concepts
- mutable referencecontrasts with · A mutable reference is a reference or handle through which the referenced value or storage location may be modified, subject to language-specific access rules.
- referencekind of · A reference is an indirect value or relationship that identifies or provides access to another value, object, resource, or source.
- copycontrasts with · Copying is the creation of a separate representation of an existing value, object, or data, preserving some or all of its contents or state.
- immutable collectioncontrasts with · An immutable collection is a collection whose membership and contents cannot be changed after creation.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


