Skip to main content

Module reader

Module reader 

Source
Expand description

Minimal byte-level reader.

Reader is the raw input abstraction: one required method, read_bytes, which hands back a zero-copy view into the source — no allocation, no copy. The view is tied to the buffer lifetime 'de, so it outlives the &mut self borrow; that is what enables zero-copy borrowed deserialization (a &'de str / &'de [u8] field can point straight into the input buffer).

The default SliceReader is backed by a &[u8], which is exactly the LibraryLink case (a fully-materialized buffer): build one over numeric_array.as_slice() and WXF values are read straight out of kernel memory.

We keep our own trait rather than std::io::Read because io::Read copies into a caller buffer and cannot lend a buffer-lifetime view. (And a copying reader would be useless anyway: FromWXF needs &'de views, which an io::Read source can’t produce — zero-copy and streaming are incompatible.)

Structs§

SliceReader
Slice-backed Reader: holds &[u8] plus a position. Every read is a bounds-checked sub-slice — no allocation, no copy.

Traits§

Reader
Raw byte source that lends buffer-lifetime views. 'de is the lifetime of the underlying buffer. Reads consume forward; there is no rewind, no peek.