OxL Справочник OxL
РусскийEnglish

data Rc

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

Example:

oxl✓ проверяется в CI
fn main() io {
  let a: Rc<i64> = Rc.new(5)
  let b = a.clone()
  print("two handles to one value")
}
Вывод
two handles to one value
@builtin("Rc") pub(api) data Rc<T>

Потокобезопасность. not transferable between tasks (use `Arc`).

С версии. 1.0.0-beta

Методы

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).

Определено в: std/core/types.oxl:535

См. также