OxL Reference

init TVar.new

A new variable with the initial value value.

Example:

oxl✓ checked in CI
use std.stm { TVar }

fn main() io {
  let v = TVar<i32>.new(5)
  print("{atomic { v.get() }}")
}
Output
5
pub(api) init new(value: T) -> Self

Since. 1.0.0-beta

Parameters

NameType
valueT

Returns

Self

Effects

none declared (pure unless the body says otherwise)

Defined in: std/stm/stm.oxl:76

See also