operator

Rust unary *: access through a reference

Dereferencing a valid reference allows access to the referred-to place. Through a mutable reference, you can update the underlying value. Expected output (not executed): 21 Why: Assignment through the reference changes the original binding. Common mistake: Dereferencing raw pointers has additional unsafe obligations; do not apply the safe-reference rule to arbitrary addresses. Advanced connection: Smart pointer behavior may involve `Deref` and `DerefMut`.

Formal Syntax & Structure

rust syntaxrust
*reference

Working Example

Example Snippetrust
fn main() {    let mut total = 14;    let reference = &mut total;    *reference = 21;    println!("{total}");}
Rust Reference