pub struct WxfReader<R> { /* private fields */ }Expand description
Typed WXF reader wrapping a raw byte Reader.
Implementations§
Source§impl<'de, R: Reader<'de>> WxfReader<R>
impl<'de, R: Reader<'de>> WxfReader<R>
Sourcepub fn new(inner: R) -> Self
pub fn new(inner: R) -> Self
Wrap a raw reader. The reader is assumed to be positioned at the start of
the WXF payload (header already consumed — see [crate::from_wxf]).
Sourcepub fn read_bytes(&mut self, n: usize) -> Result<&'de [u8], Error>
pub fn read_bytes(&mut self, n: usize) -> Result<&'de [u8], Error>
Consume n raw bytes as a zero-copy, buffer-lifetime view.
Sourcepub fn read_varint(&mut self) -> Result<u64, Error>
pub fn read_varint(&mut self) -> Result<u64, Error>
Read a WXF varint (LEB128, 7-bit groups, little-endian).
Sourcepub fn read_expr_token(&mut self) -> Result<ExpressionEnum, Error>
pub fn read_expr_token(&mut self) -> Result<ExpressionEnum, Error>
Consume the next expression token byte.
Sourcepub fn read_numeric_type(&mut self) -> Result<NumericArrayEnum, Error>
pub fn read_numeric_type(&mut self) -> Result<NumericArrayEnum, Error>
Consume a NumericArray element-type byte.
Sourcepub fn read_packed_type(&mut self) -> Result<PackedArrayEnum, Error>
pub fn read_packed_type(&mut self) -> Result<PackedArrayEnum, Error>
Consume a PackedArray element-type byte (numeric subset).
Sourcepub fn read_str(&mut self) -> Result<&'de str, Error>
pub fn read_str(&mut self) -> Result<&'de str, Error>
Read a String/Symbol-shaped payload: varint length + UTF-8 bytes.
Zero-copy — returns a &'de str view into the underlying buffer, so it
serves both the owned path (.to_owned()) and borrowed fields (&'de str).
Sourcepub fn read_string(&mut self) -> Result<String, Error>
pub fn read_string(&mut self) -> Result<String, Error>
Read a complete String value (token + payload) into an owned String.
Used for keys/labels where the token has not been pre-consumed.
Sourcepub fn read_symbol_name(&mut self) -> Result<String, Error>
pub fn read_symbol_name(&mut self) -> Result<String, Error>
Read a Symbol/BigInteger/BigReal payload as an owned name/digit
string (varint length + UTF-8). The consumer parses it into the
appropriate value type.
Sourcepub fn read_byte_array(&mut self) -> Result<&'de [u8], Error>
pub fn read_byte_array(&mut self) -> Result<&'de [u8], Error>
Read a ByteArray payload: varint length + raw bytes. Zero-copy — returns
a &'de [u8] view into the underlying buffer (owned path copies via
.to_vec(); borrowed &'de [u8] fields keep it).
Sourcepub fn read_numeric_array_parts(
&mut self,
) -> Result<(NumericArrayEnum, Vec<usize>, Vec<u8>), Error>
pub fn read_numeric_array_parts( &mut self, ) -> Result<(NumericArrayEnum, Vec<usize>, Vec<u8>), Error>
Read the body of a NumericArray/PackedArray token (tag already
consumed): element type + rank + dims + flat little-endian buffer.
Returns the element type, the dims, and the owned byte buffer.
Sourcepub fn read_array_body(
&mut self,
elem_size: usize,
) -> Result<(Vec<usize>, Vec<u8>), Error>
pub fn read_array_body( &mut self, elem_size: usize, ) -> Result<(Vec<usize>, Vec<u8>), Error>
Shared array tail: rank varint, rank dim varints, then the flat
little-endian byte buffer (prod(dims) * elem_size bytes).