Skip to main content

decode

Function decode 

Source
pub fn decode(frame: &Frame) -> Result<Option<ExecEvent>, Error>
Expand description

Maps one frame onto a typed event.

Three outcomes, and the middle one is the reason this returns a nested Result:

  • Ok(Some(event)) — a recognized event.
  • Ok(None) — a frame this client does not dispatch. An unknown event name, or a payload that will not parse. Dropped rather than raised, matching the daemon, which degrades a serialization failure to {} on purpose instead of taking the connection down: one bad frame must not end an otherwise live stream.
  • Err(_) — an output event whose base64 will not decode. Distinct from the above because it is unambiguously corruption of bytes a caller asked for, and silently dropping output is the failure this whole protocol is shaped to prevent.