future/manual

Types

pub type FailureFunction =
  fn(String) -> Nil
pub type RejectFunction(reject) =
  fn(reject) -> Nil
pub type ResultFunction(result) =
  fn(result) -> Nil

Values

pub fn new(
  ,
) -> #(
  fn(result) -> Nil,
  fn(reject) -> Nil,
  fn(String) -> Nil,
  future.Future(Nil, result, reject),
)

Creates a future with a manual result, reject and failure function

The first result/reject/failure function to be called will be the result of the future. Any further calls will be ignored

Do note that the result, reject and failure functions are asynchronous and will NOT pause execution flow

Please note that lifecycle management of this future is managed by YOU! You MUST release it when you are done with it else have a memory leak! (This comes from how the erlang gc works) If you want to immediately release the future on completion then use auto_release!

Search Document