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>
impl Encoder<'static, PredictorState>
Sourcepub fn new(
set: &SchemaSet,
message_index: usize,
cfg: EncoderConfig,
) -> Result<Self, ConfigError>
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>
impl Encoder<'static>
Sourcepub fn with_registry(
set: &SchemaSet,
message_index: usize,
cfg: EncoderConfig,
registry: &PredictorRegistry,
) -> Result<Self, ConfigError>
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>
impl<P: PredictorBuilder + 'static> Encoder<'static, P>
Sourcepub fn with_predictors(
set: &SchemaSet,
message_index: usize,
cfg: EncoderConfig,
) -> Result<Self, ConfigError>
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>
impl<'a, P: PredictorBuilder + 'static> Encoder<'a, P>
Sourcepub fn with_storage(
schema: &SchemaRef<'_>,
message_index: usize,
cfg: EncoderConfig,
registry: Option<&PredictorRegistry>,
storage: EncoderStorage<'a, P>,
) -> Result<Self, ConfigError>
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.
Sourcepub fn plan<'v>(
&self,
values: &'v [Value],
now_ns: u64,
) -> Result<Plan<'v>, EncodeError>
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.
Sourcepub fn plan_ref<'v>(
&self,
values: &[ValueRef<'v>],
now_ns: u64,
) -> Result<Plan<'v>, EncodeError>
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.
pub fn plan_into<'v>( &self, values: &[ValueRef<'v>], now_ns: u64, out: &mut PlanBuf<'_, 'v>, ) -> Result<(), EncodeError>
Sourcepub fn commit_into(
&mut self,
plan: &PlanBuf<'_, '_>,
out: &mut [u8],
) -> Result<EncodeInfo, EncodeError>
pub fn commit_into( &mut self, plan: &PlanBuf<'_, '_>, out: &mut [u8], ) -> Result<EncodeInfo, EncodeError>
Write a borrowed plan and advance encoder state without allocating.
Sourcepub fn commit(
&mut self,
plan: Plan<'_>,
out: &mut [u8],
) -> Result<EncodeInfo, EncodeError>
pub fn commit( &mut self, plan: Plan<'_>, out: &mut [u8], ) -> Result<EncodeInfo, EncodeError>
Write a planned frame and advance encoder state.
Sourcepub fn encode(
&mut self,
values: &[Value],
now_ns: u64,
out: &mut [u8],
) -> Result<EncodeInfo, EncodeError>
pub fn encode( &mut self, values: &[Value], now_ns: u64, out: &mut [u8], ) -> Result<EncodeInfo, EncodeError>
Plan and commit in one call.
Sourcepub fn encode_ref(
&mut self,
values: &[ValueRef<'_>],
now_ns: u64,
out: &mut [u8],
) -> Result<EncodeInfo, EncodeError>
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.
Sourcepub fn state_hashes(&self) -> impl Iterator<Item = u64> + '_
pub fn state_hashes(&self) -> impl Iterator<Item = u64> + '_
State hash of each predictor, in predictor-field order.