charge/async

Values

pub fn to_async1(f: fn(a) -> b) -> fn(a) -> promise.Promise(b)

Convert a one-parameter function to an async one

pub fn to_async2(
  f: fn(a, b) -> c,
) -> fn(a, b) -> promise.Promise(c)

Convert a two-parameter function to an async one

pub fn try_resolve(
  result: Result(a, b),
  cb: fn(a) -> promise.Promise(Result(c, b)),
) -> promise.Promise(Result(c, b))

A drop-in replacement for result.try when in a promise context. Wraps results in a promise so that they can be used in use statements within a function ensuring consistent returns

Search Document