Packages

A async futures library for gleam supporting erlang and javascript (deno, bun, node)

Current section

Files

Jump to
future src future@manual.erl
Raw

src/future@manual.erl

-module(future@manual).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-define(FILEPATH, "src\\future\\manual.gleam").
-export([new/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
-file("src\\future\\manual.gleam", 36).
?DOC(
" Creates a future with a manual result, reject and failure function\n"
" \n"
" The first result/reject/failure function to be called will be the result of the future. Any further calls will be ignored\n"
" \n"
" Do note that the result, reject and failure functions are asynchronous and will NOT pause execution flow\n"
" \n"
" > Please note that lifecycle management of this future is managed by YOU!\n"
" > You MUST release it when you are done with it else have a memory leak! (This comes from how the erlang gc works)\n"
" > If you want to immediately release the future on completion then use `auto_release`!\n"
).
-spec new() -> {fun((EBY) -> nil),
fun((ECA) -> nil),
fun((binary()) -> nil),
future:future(nil, EBY, ECA)}.
new() ->
future_manual:create().