Skip to main content

Module checked

Module checked 

Source
Expand description

Partial-stream failure semantics for flatwire (checked streams), matching the Python/Node reference. A streamed collection is wrapped in an envelope whose terminal status is written LAST:

  {"items":[ e0, e1, ... ],"complete":true}
  {"items":[ e0, e1, ... ],"complete":false,"error":{"message":"...","type":"..."}}

so a consumer can tell clean completion, an in-band producer error after N rows, and truncation apart. The wire is plain JSON, so a checked stream written by any flatwire language decodes here and vice versa. See docs/FAILURE.md.

Structs§

CheckedArrayIter
A lazy iterator over the elements of a checked envelope. Each next() yields Ok(Value) per element; after the last element the iterator enforces the terminal status, yielding Err(CheckedError::Stream) if the producer signalled complete:false or Err(CheckedError::Truncated) if the stream ended without a terminal status. A clean stream ends with None and no error.

Enums§

CheckedError
Outcome of iterating a CheckedArrayIter to its end, delivered as the terminal Err variants so a consumer can distinguish the three cases.

Functions§

decode_checked_array
encode_checked_array
Stream items inside a checked envelope, writing the terminal status last. If serializing an element fails, a complete:false trailer carrying the error is written before the error is returned, so the consumer can distinguish failure from truncation. Returns the number of elements written.