Expand description
A plugin in Rust on both targets (docs/PLUGINS.md §8.3): in process natively, a WASM reactor on wasm32-wasip1, with
the same source.
A reactor keeps its state between two calls of its export escouade-turn, as an instance of run.js does. The host
writes on its standard input, which never blocks, then calls a turn: the plugin reads what came and writes its lines,
and the turn ends. Nothing waits inside a turn: an answer of the host comes as a line of a later turn.
runis what a state machine calls in place ofcrate::serve;escouade-plugin-kithas its own, for a plugin whose calls wait.crate::module!exports the turn. It is one line of the plugin, nothing at all natively.instance_idandread_fileare whatstd::process::idandstd::fscannot be in a module.- On
wasm32,lines,write,flush,set_turnare the kit’s way in, andhost_callthe synchronous door to the host (escouade.call).
Functions§
- instance_
id - What tells the ids of this instance from those of the one before it, restarted: its process.
- read_
file - A file a state machine must have before it answers: from the disk natively; in a module, read by the host, under a
folder the plugin declares (
fs/read, docs/PLUGINS.md §8.4.6). None when it cannot be read, or is refused. - run
- The loop of a state machine, whatever the target: natively,
crate::serveon the standard input and output until they end, its exit code answered; in a module,handlerkept for the turns to come.