Skip to main content

WxfReader

Struct WxfReader 

Source
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>

Source

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]).

Source

pub fn read_byte(&mut self) -> Result<u8, Error>

Consume one raw byte.

Source

pub fn read_bytes(&mut self, n: usize) -> Result<&'de [u8], Error>

Consume n raw bytes as a zero-copy, buffer-lifetime view.

Source

pub fn read_varint(&mut self) -> Result<u64, Error>

Read a WXF varint (LEB128, 7-bit groups, little-endian).

Source

pub fn read_expr_token(&mut self) -> Result<ExpressionEnum, Error>

Consume the next expression token byte.

Source

pub fn read_numeric_type(&mut self) -> Result<NumericArrayEnum, Error>

Consume a NumericArray element-type byte.

Source

pub fn read_packed_type(&mut self) -> Result<PackedArrayEnum, Error>

Consume a PackedArray element-type byte (numeric subset).

Source

pub fn read_i8(&mut self) -> Result<i8, Error>

Read an Integer8 payload.

Source

pub fn read_i16(&mut self) -> Result<i16, Error>

Read an Integer16 payload.

Source

pub fn read_i32(&mut self) -> Result<i32, Error>

Read an Integer32 payload.

Source

pub fn read_i64(&mut self) -> Result<i64, Error>

Read an Integer64 payload.

Source

pub fn read_f64(&mut self) -> Result<f64, Error>

Read a Real64 payload.

Source

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).

Source

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.

Source

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.

Source

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).

Source

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.

Source

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).

Source

pub fn read_rule(&mut self) -> Result<bool, Error>

Read one Rule / RuleDelayed token; returns the delayed flag.

Source

pub fn skip(&mut self) -> Result<(), Error>

Read one complete value at the current position and discard it. Used to drop an unknown Association key’s value, or a Function head whose shape isn’t validated.

Auto Trait Implementations§

§

impl<R> Freeze for WxfReader<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for WxfReader<R>
where R: RefUnwindSafe,

§

impl<R> Send for WxfReader<R>
where R: Send,

§

impl<R> Sync for WxfReader<R>
where R: Sync,

§

impl<R> Unpin for WxfReader<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for WxfReader<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for WxfReader<R>
where R: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.