Expand description
AbxStreamParser — pull parser over any Read source.
Unlike crate::AbxParser which requires the whole document in memory,
AbxStreamParser reads from any std::io::Read implementor (files, TCP
sockets, stdin, in-memory Cursor<Vec<u8>>, …) using a small internal
ring buffer.
The public surface is intentionally identical to AbxParser so the two
types are interchangeable; just swap the constructor.
§Internal design
We keep a Vec<u8> ring buffer (buf) and a pos cursor. When a nom
parser reports Incomplete we refill from the reader, slide unconsumed
bytes to the front, and retry. This gives us:
- bounded memory — the buffer only grows when a single atom (e.g. a very long string) exceeds the current capacity.
- zero extra copies — nom operates directly on
&buf[pos..]. - identical event types —
Event,Attribute,AttributeValueare all shared with the slice parser.
Structs§
- AbxStream
Parser - Pull parser that reads from any
R: Readsource. - Deserialize
Iter - Lazily yields each remaining
<element>, deserialized intoT. SeeAbxStreamParser::deserialize_iter.