gossamer/promise
Types
Values
pub fn all(values: List(Promise(a))) -> Promise(List(a))
Resolves with a list of results when all provided promises resolve, or rejects when any promise is rejected.
pub fn all_settled(
values: List(Promise(a)),
) -> Promise(List(promise_settled_result.PromiseSettledResult(a)))
Resolves with a list of PromiseSettledResults when all provided promises
have settled (resolved or rejected), never short-circuiting on rejection.
pub fn any(values: List(Promise(a))) -> Promise(a)
Resolves with the first fulfilled promise’s value. Rejects with an AggregateError only if all provided promises are rejected.
pub fn catch(
promise: Promise(a),
apply onrejected: fn(dynamic.Dynamic) -> a,
) -> Promise(a)
pub fn from_option(option: option.Option(a)) -> Promise(a)
pub fn from_result(result: Result(a, r)) -> Promise(a)
pub fn race(values: List(Promise(a))) -> Promise(a)
Resolves or rejects as soon as any of the provided promises resolves or rejects, taking on that promise’s value.
pub fn with_resolvers() -> PromiseWithResolvers(a, r)