Skip to main content

Encoder

Struct Encoder 

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

Encoder for one message of a schema set.

Implementations§

Source§

impl Encoder<'static, PredictorState>

Source

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

Construct an encoder for message_index in set.

Source§

impl Encoder<'static>

Source

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

Construct an encoder using an explicit runtime registry for custom models.

Source§

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

Source

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

Construct an encoder with a custom predictor builder/set.

Source§

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

Source

pub fn with_storage( schema: &SchemaRef<'_>, message_index: usize, cfg: EncoderConfig, registry: Option<&PredictorRegistry>, storage: EncoderStorage<'a, P>, ) -> Result<Self, ConfigError>

Construct an encoder from a borrowed schema and caller-provided storage.

This is the single engine used by every allocator-backed convenience constructor. No allocation occurs after construction.

Source

pub fn plan<'v>( &self, values: &'v [Value], now_ns: u64, ) -> Result<Plan<'v>, EncodeError>

Decide how the next frame would be encoded without changing any state.

Source

pub fn plan_ref<'v>( &self, values: &[ValueRef<'v>], now_ns: u64, ) -> Result<Plan<'v>, EncodeError>

Decide how the next frame would be encoded from borrowed values.

Source

pub fn plan_into<'v>( &self, values: &[ValueRef<'v>], now_ns: u64, out: &mut PlanBuf<'_, 'v>, ) -> Result<(), EncodeError>

Source

pub fn commit_into( &mut self, plan: &PlanBuf<'_, '_>, out: &mut [u8], ) -> Result<EncodeInfo, EncodeError>

Write a borrowed plan and advance encoder state without allocating.

Source

pub fn commit( &mut self, plan: Plan<'_>, out: &mut [u8], ) -> Result<EncodeInfo, EncodeError>

Write a planned frame and advance encoder state.

Source

pub fn encode( &mut self, values: &[Value], now_ns: u64, out: &mut [u8], ) -> Result<EncodeInfo, EncodeError>

Plan and commit in one call.

Source

pub fn encode_ref( &mut self, values: &[ValueRef<'_>], now_ns: u64, out: &mut [u8], ) -> Result<EncodeInfo, EncodeError>

Plan and commit borrowed values in one call.

Source

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

State hash of each predictor, in predictor-field order.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<'a, P> UnsafeUnpin for Encoder<'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.