init TVar.new
A new variable with the initial value value.
Example:
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) -> SelfSince. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
value | T |
Returns
Self
Effects
none declared (pure unless the body says otherwise)
Defined in: std/stm/stm.oxl:76