Skip to main content

Module protocol

Module protocol 

Source
Expand description

JSON/RPC wire protocol — line-delimited JSON encoding of the existing UiEvent (out) and Command (in) enums. See docs/json.md and docs/rpc.md.

Structs§

ProtocolError
A failure to decode a client command line.
SessionHeader
The first line emitted on any JSON/RPC stream.

Constants§

PROTOCOL_VERSION
Bumped when the wire schema changes incompatibly.

Functions§

decode_command
Decode one JSONL line into a Command.
encode_event
Encode one UiEvent as a single JSON object (no trailing newline — the stream writer adds \n). Encoding cannot realistically fail for our derived Serialize; if it ever does, fall back to an error line so the stream stays valid JSONL.
serialize_branch_tree
#[serde(serialize_with = "…")] target for UiEvent::BranchTree’s payload — motosan’s BranchTree/BranchNode are not Serialize, so map them into a local serializable shape.