Skip to main content

Decoder

Struct Decoder 

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

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

Implementations§

Source§

impl Decoder<'static, PredictorState>

Source

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

Construct a decoder for every message in set.

Source§

impl Decoder<'static>

Source

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

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

Source§

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

Source

pub fn with_storage( schema: &SchemaRef<'_>, cfg: DecoderConfig, registry: Option<&PredictorRegistry>, storage: DecoderStorage<'a, P>, ) -> Result<Self, 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.

Source

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.

Source

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.

Source

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.

Source

pub fn crc_fail_streak(&self) -> u32

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

Source

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

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

Source

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

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

Source§

impl Decoder<'static>

Source

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

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

Source§

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

Source

pub fn with_predictors( set: &SchemaSet, cfg: DecoderConfig, ) -> Result<Self, ConfigError>

Construct a decoder with a custom predictor builder/set.

Source§

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

Source

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.