Asynchronous programming library for MoonBit
moon add moonbitlang/async@0.20.3async fn[X] with_task_group(async (TaskGroup[X]) -> X) -> Xpub(all) suberror BreakFromSpawnLoopimpl Show for TimeoutErrortype Lazy[X]type Mutexpub(all) enum RetryMethod {
Immediate
FixedDelay(Int)
ExponentialDelay(initial~ : Int, factor~ : Double, maximum~ : Int)
}type Task[X]type TaskGroup[X]fn[X] TaskGroup::spawn_loop(self : TaskGroup[X], f : async () -> Unit, no_wait? : Bool, allow_failure? : Bool, retry? : RetryMethod, max_retry? : Int, fatal_error? : (Error) -> Bool) -> Unitpub struct Timer {
duration : Int
// private fields
}fn is_cancellation_error(error : Error) -> Boolasync fn[X] protect_from_cancel(f : async () -> X, resume_on_cancel? : Bool) -> Xasync fn[X] retry(strategy : RetryMethod, max_retry? : Int, fatal_error? : (Error) -> Bool, f : async () -> X) -> Xasync 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