View Source WaitForIt.Waitable protocol (WaitForIt v2.1.2)

Protocol used for evaluating waitable expressions against waiting conditions to determine if waiting should continue or halt with a final value.

Summary

Types

t()

All the types that implement this protocol.

Functions

Evaluates the waitable expression to provide its value, or to continue to wait.

Provides the final value of the waitable expression in the event of a timeout.

Types

@type t() :: term()

All the types that implement this protocol.

@type value() :: any()
@type wait_type() :: atom()

Functions

@spec evaluate(t(), Macro.Env.t()) :: {:halt, value()} | {:cont, value()}

Evaluates the waitable expression to provide its value, or to continue to wait.

It should return {:halt, value} if the wait is over and the final value of the waitable expression has been determined, or {:cont, value} if waiting should continue.

Link to this function

handle_timeout(waitable, last_value, env)

View Source
@spec handle_timeout(t(), value(), Macro.Env.t()) :: value()

Provides the final value of the waitable expression in the event of a timeout.

@spec wait_type(t()) :: wait_type()