Expand description
Host (javascript) interface: callbacks, values exchanged with the host, and the executor of the async ports.
The typescript pipeline awaits host promises (visitors, loaders, scoped name generators). The rust ports are
async fns: a HostPromise future is pending until the host settles the promise (settle_promise). The host
drives a Task: poll() returns the ids of the pending promises, the host awaits them, settles them and polls
again. The same mechanism serves the N-API and the WASM bindings: no thread, no runtime.
Structs§
- Host
Error - error raised by the host or by the port (
throw new Error(message)) - Host
Promise - a host promise awaited by the rust code
- NoHost
- a host without callbacks (rust callers)
- Task
- an async computation driven by the host
Enums§
- HostDef
- a host definition: the javascript visitor maps and options, with the functions replaced by callback ids
- Host
Value - a value exchanged with the host
- Task
State - state of a task after a poll
Traits§
- Host
- the host: calls the javascript callbacks
Functions§
- block_
on - run a future synchronously: the sync api (
parseSync()). a pending host promise is an error, like the typescript sync functions that do not await - resolve
- await a host value: a promise is awaited, the other values are returned
- settle_
promise - settle a host promise: the task that awaits it is polled again by the host