Skip to content

Std.Deferred

effect Deferred[A]

A box for one value of type A. dbg shows the capability as <deferred>.

  • fn complete(value: A) -> Bool

    Puts value in the box and returns True the first time. Afterwards does nothing and returns False. Does not suspend.

  • suspend fn await() -> A

    Waits until the box has a value, and returns it. Any number of tasks may wait on one box.

  • fn poll() -> Option[A]

    The value if the box has one, None otherwise. Does not wait or suspend.

handler Deferred[A]: Deferred[A]

Makes an empty box. Its release does nothing.