Streaming parser
Use Step or Drain and process borrowed fragments against the exact unchanged input passed to the producing call.
Flyology CBOR parses arbitrary byte chunks into provisional syntax events. Its writers stage one complete document before publication. The bounded parser and writer allocate no heap storage.
-- The chunk is complete. Drain batches provisional events into the
-- caller-owned event array and reports complete-document acceptance.
Parsing.Drain
(Self => Parser,
Input => Input,
End_Of_Input => True,
Events => Events,
Result => Parse_Result);
-- Finish_Document makes the staged complete value eligible. Copy_Output
-- never exposes an incomplete prefix as successful output.
Writing.Begin_Document (Writer, Diagnostic);
Writing.Put_Unsigned (Writer, 42, Diagnostic);
Writing.Finish_Document (Writer, Diagnostic);
Writing.Copy_Output (Writer, Output, Produced, Diagnostic);
The bounded and allocating facades own unpublished staging. Finish_Document validates the
balanced CBOR item and is the only publication request. A failure or abort never makes a staged prefix
eligible as output.
Abort or failure ends unpublished staging without publication.
Flyology CBOR owns byte syntax and diagnostics. Your application owns transport buffers, the event array, logical interpretation, and the decision to accept a decoded candidate.
Use Step or Drain and process borrowed fragments against the exact unchanged input passed to the producing call.
Own a fixed staging buffer with observable unpublished length and Completed-only output.
Preserve CBOR integer arguments, tag numbers, simple codes, and float widths before interpretation.