method TVar.update
set(f(get())).
Example:
use std.stm { TVar }
fn main() io {
let v = TVar<i32>.new(10)
atomic { v.update(x => x + 5) }
print("{atomic { v.get() }}")
}Output
15
pub(api) fn update(f: fn(T) -> T)Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
f | fn(T) -> T |
Effects
none declared (pure unless the body says otherwise)
Defined in: std/stm/stm.oxl:123