Asynchronous programming library for MoonBit
moon add moonbitlang/async@0.19.2async fn[X] with_task_group(async (TaskGroup[X]) -> X) -> Xpub(all) suberror BreakFromSpawnLoopimpl Show for TimeoutErrorpub struct Lazy[X] {
// private fields
}
#alias(new, deprecated="`new` is deprecated, use `Lazy` instead")
#as_free_fn(lazy_init, deprecated="use `@async.Lazy(..)` instead")
fn Lazy::Lazy(f : async () -> X) -> Lazy[X]pub(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 () -> Unit, no_wait? : Bool, allow_failure? : Bool, retry? : RetryMethod, max_retry? : Int, fatal_error? : (Error) -> Bool) -> Unitpub struct Timer {
duration : Int
// private fields
}
#alias(new, deprecated="`new` is deprecated, use `Timer` instead")
fn Timer::Timer(duration : Int) -> Timerfn is_cancellation_error(error : Error) -> Boolfn now() -> Int64async 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 sleep(duration : Int) -> Unitasync 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