menu
AsyncOnceCell
import { AsyncOnceCell } from "destack:async";
One-time async initialized cell.
1export class AsyncOnceCell<T> {2 value: MaybeUninit<T>;3 get(): &readonly T | undefined;4 set(value: ^T): Result<void, ^T>;5 getOrInit(init: () => Task<T>): Task<&readonly T>;6 take(): T | undefined;7}Members
value: MaybeUninit<T>The stored value.
get(): &readonly T | undefinedGet the initialized value.
set(value: ^T): Result<void, ^T>Set the value once.
take(): T | undefinedMove the value out when initialized.