API reference
Everything lives in the fiber\ namespace of fiber-interop/api; no global names are declared. Every page here is derived from the docblocks and code of that package, and every example runs on phasync and Revolt.
Functions
setup() | Install the adapter that serves the fiber\ functions. |
register() | Offer an adapter as a candidate (called by adapter packages). |
adapter() | The configured adapter. |
go() | Start a task concurrently and return an opaque awaitable. |
await() | Wait for an awaitable and return its result. |
await_all() | Wait for every awaitable; results keep their keys. |
await_any() | Return the result of the first awaitable to fulfil. |
run() | The only entry point: run $f and wait for every task it started. |
service() | Start a task that does not count towards the enclosing run(). |
sleep() | Suspend the current fiber without blocking others. |
readable() | Wait until a stream is readable and return it. |
writable() | Wait until a stream is writable and return it. |
Classes, interfaces and exceptions
fiber\Adapterinterface | What an event loop implements to serve the functions: go, service, canAwait, await, sleep, readable, writable. Every wait follows the in-place rule. |
fiber\TimeoutExceptioninterface | Thrown by await*, readable() and writable() when the timeout expires. The awaited task keeps running. |
fiber\Timeoutclass | The TimeoutException used when the adapter's loop has no native timeout exception. |
fiber\CancelledExceptioninterface | Thrown by sleep() and the waits when the owning loop cancels the task. Loops implement it on their own exception class. |
fiber\NotInRunExceptionclass (extends LogicException) | Thrown by go(), await(), sleep() and the other waits when no fiber\run() is active. |
fiber\NotConfiguredExceptionclass (extends LogicException) | No adapter is set up, or several are installed and setup() was not called. |
fiber\RejectedExceptionclass (extends RuntimeException) | A promise was rejected with a reason that is not a Throwable; getReason() returns it unchanged. |
fiber\Deferred, Frameinternal | Not public API. Deferred is a minimal then-able used by await_any(); Frame tracks the tasks of one run(). |