Skip to main content

decode_line

Function decode_line 

Source
pub fn decode_line(line: &str) -> Result<Incoming, DecodeError>
Expand description

Parses one NDJSON line into its discriminated Incoming shape.

Discrimination follows JSON-RPC 2.0’s own shape rules rather than a tag field the wire types don’t carry: a method key marks a request (if id is also present) or a notification (no id); an id key with no method marks a response. A trailing \n, if present, is stripped first so a caller can hand this either a bare line or one still carrying its terminator.