Asynchronous programming library for MoonBit
moon add moonbitlang/async@0.9.0async fn[X] with_task_group(async (TaskGroup[X]) -> X) -> Xpub suberror AlreadyTerminated
impl Show for AlreadyTerminatedpub(all) enum RetryMethod {
Immediate
FixedDelay(Int)
ExponentialDelay(Int, Double, Int)
}type Task[X]type TaskGroup[X]fn[X] TaskGroup::spawn_loop(self : TaskGroup[X], f : async () -> IterResult, no_wait? : Bool, allow_failure? : Bool, retry? : RetryMethod, max_retry? : Int) -> Unit raisefn now() -> Int64async fn pause() -> Unitasync fn protect_from_cancel(f : async () -> Unit) -> Unitfn run_async_main(main : async () -> Unit) -> Unitasync fn sleep(duration : Int) -> Unit#deprecated("use `async fn main` or `async test` instead")
fn with_event_loop(f : async (TaskGroup[Unit]) -> Unit) -> Unit raiseasync fn[X] with_timeout(time : Int, f : async () -> X, error? : Error) -> Xasync fn[X] with_timeout_opt(time : Int, f : async () -> X) -> X?Asynchronous programming library for MoonBit