References

References are denoted with a reference token.

let variable = &expression

There are two types of references:

  • Unique

  • Shared

Unique references are denoted with a unique token in front of the reference token.

let variable = ~&expression

References may also appear in type ascriptions.

let variable: &Type = &expression

Dereference

References can be dereferenced with the dereference operator.

let reference = &expression
let variable = *reference

This accesses the value that the reference is referencing.

‚Äč