Skip to content

References and Pointers

Current forms:

  • *T owning pointer
  • &T shared borrow
  • &mut T mutable borrow
  • ^T / ^const T raw pointers
fn set_to_one(x: &mut i32) {
*x = 1
}

Raw pointer use should stay inside unsafe blocks and explicit std/mem APIs.