Skip to main content

Module protocol

Module protocol 

Source
Expand description

Wire format: line-delimited JSON over a duplex byte stream. Each request is one JSON object on one line; each response is one JSON object on one line; lines end with \n. No length prefix — the framing is the newline. NDJSON keeps tools such as nc -U piped through jq usable for ad-hoc poking. The same frame shapes ride the HTTP-over-TCP transport (NDJSON over chunked encoding).

Structs§

EndMarker
Empty marker payload for the End outcome. Encoded as {} so future fields (e.g. a final summary) can be added without breaking the wire shape.
Request
Client → server frame.
Response
Server → client frame.
WireError
Structured error frame. message is a human-readable summary; details, when present, carries verb-specific structured context (compile error site, timeout stage, etc.) that the CLI can render alongside the message.

Enums§

ResponseOutcome
Successful result or structured error. Flattened into Response so the wire shape is {"id":N,"result":{...}} or {"id":N,"error":{...}} rather than a nested outcome key.
WireErrorKind
Error category. The full string message carries detail; the kind is the machine-readable discriminator.

Functions§

encode_line
Encode a value as JSON and append \n. Centralises framing so server.rs / client.rs share one implementation.