OxL Reference

data Rc

Single-task reference counted pointer (§3.9, §7.3): not transferable between tasks.

Example:

oxl✓ checked in CI
fn main() io {
  let a: Rc<i64> = Rc.new(5)
  let b = a.clone()
  print("two handles to one value")
}
Output
two handles to one value
@builtin("Rc") pub(api) data Rc<T>

Thread safety. not transferable between tasks (use `Arc`).

Since. 1.0.0-beta

Methods

new(value: T) -> Rc<T>
A new reference-counted pointer to value.
clone() -> Rc<T>
Another pointer to the same value (the count grows by one).

Defined in: std/core/types.oxl:535

See also