Skip to main content

Decoder

Struct Decoder 

pub struct Decoder<'a, P = PredictorState>{ /* private fields */ }
Expand description

Decoder for one incoming stream; message IDs dispatch within that stream.

Implementations§

§

impl Decoder<'static>

pub fn new( set: &SchemaSet, cfg: DecoderConfig, ) -> Result<Decoder<'static>, ConfigError>

Construct a decoder for every message in set.

§

impl Decoder<'static>

pub fn with_registry( set: &SchemaSet, cfg: DecoderConfig, registry: &PredictorRegistry, ) -> Result<Decoder<'static>, ConfigError>

Construct a decoder using an explicit runtime registry for custom models.

§

impl<'a, P> Decoder<'a, P>
where P: PredictorBuilder + 'static,

pub fn with_storage( schema: &SchemaRef<'_>, cfg: DecoderConfig, registry: Option<&PredictorRegistry>, storage: DecoderStorage<'a, P>, ) -> Result<Decoder<'a, P>, ConfigError>

Construct a decoder from a borrowed schema and caller-provided storage.

The engine only uses the schema during construction. Afterward all wire metadata lives in the supplied FieldInfo storage, so the decoder never borrows the schema and can be 'static in allocator-backed builds.

pub fn parse_into( &mut self, frame: &[u8], out: &mut ParsedBuf<'_>, ) -> Result<(), DecodeError>

Parse one frame into caller-provided staging buffers without changing any predictor or sequence state.

pub fn apply_into<'d>( &'d mut self, parsed: &mut ParsedBuf<'_>, out: &'d mut DecodedBufStorage<'d>, ) -> Result<DecodedBuf<'d>, DecodeError>

Validate and apply one parsed frame, borrowing decoded values from the decoder’s staging and persistent opaque pools.

pub fn decode_into<'d>( &'d mut self, frame: &[u8], parsed: &'d mut ParsedBuf<'_>, out: &'d mut DecodedBufStorage<'d>, ) -> Result<DecodedBuf<'d>, DecodeError>

Parse, validate and apply one frame using borrowed output storage.

pub fn crc_fail_streak(&self) -> u32

Number of consecutive CRC failures seen since the last good CRC.

pub fn state_hashes(&self, message_index: usize) -> impl Iterator<Item = u64>

Predictor state hashes for one message, in predictor-field order.

pub fn field_trust(&self, message_index: usize) -> impl Iterator<Item = bool>

Whether each predictor field is trusted, in predictor-field order.

§

impl Decoder<'static>

pub fn with_predictors_and_registry_public( set: &SchemaSet, cfg: DecoderConfig, registry: &PredictorRegistry, ) -> Result<Decoder<'static>, ConfigError>

Construct a decoder with an explicit runtime registry for custom models.

§

impl<P> Decoder<'static, P>
where P: PredictorBuilder + 'static,

pub fn with_predictors( set: &SchemaSet, cfg: DecoderConfig, ) -> Result<Decoder<'static, P>, ConfigError>

Construct a decoder with a custom predictor builder/set.

§

impl<'a, P> Decoder<'a, P>
where P: PredictorBuilder + 'static,

pub fn feed(&mut self, frame: &[u8]) -> Result<Decoded, DecodeError>

Parse and apply one frame (allocator-backed output convenience).

Auto Trait Implementations§

§

impl<'a, P = PredictorState> !UnwindSafe for Decoder<'a, P>

§

impl<'a, P> Freeze for Decoder<'a, P>

§

impl<'a, P> RefUnwindSafe for Decoder<'a, P>
where P: RefUnwindSafe,

§

impl<'a, P> Send for Decoder<'a, P>
where P: Send,

§

impl<'a, P> Sync for Decoder<'a, P>
where P: Sync,

§

impl<'a, P> Unpin for Decoder<'a, P>
where P: Unpin,

§

impl<'a, P> UnsafeUnpin for Decoder<'a, P>

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.