Struct Decoder
pub struct Decoder<'a, P = PredictorState>where
P: PredictorBuilder,{ /* private fields */ }Expand description
Decoder for one incoming stream; message IDs dispatch within that stream.
Implementations§
§impl Decoder<'static>
impl Decoder<'static>
pub fn new(
set: &SchemaSet,
cfg: DecoderConfig,
) -> Result<Decoder<'static>, ConfigError>
pub fn new( set: &SchemaSet, cfg: DecoderConfig, ) -> Result<Decoder<'static>, ConfigError>
Construct a decoder for every message in set.
§impl Decoder<'static>
impl Decoder<'static>
pub fn with_registry(
set: &SchemaSet,
cfg: DecoderConfig,
registry: &PredictorRegistry,
) -> Result<Decoder<'static>, ConfigError>
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,
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>
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>
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>
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>
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
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>
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>
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>
impl Decoder<'static>
pub fn with_predictors_and_registry_public(
set: &SchemaSet,
cfg: DecoderConfig,
registry: &PredictorRegistry,
) -> Result<Decoder<'static>, ConfigError>
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,
impl<P> Decoder<'static, P>where
P: PredictorBuilder + 'static,
pub fn with_predictors(
set: &SchemaSet,
cfg: DecoderConfig,
) -> Result<Decoder<'static, P>, ConfigError>
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,
impl<'a, P> Decoder<'a, P>where
P: PredictorBuilder + 'static,
pub fn feed(&mut self, frame: &[u8]) -> Result<Decoded, DecodeError>
pub fn feed(&mut self, frame: &[u8]) -> Result<Decoded, DecodeError>
Parse and apply one frame (allocator-backed output convenience).