Struct Encoder
pub struct Encoder<'a, P = PredictorState>where
P: PredictorBuilder,{ /* private fields */ }Expand description
Encoder for one message of a schema set.
Implementations§
§impl Encoder<'static>
impl Encoder<'static>
pub fn new(
set: &SchemaSet,
message_index: usize,
cfg: EncoderConfig,
) -> Result<Encoder<'static>, ConfigError>
pub fn new( set: &SchemaSet, message_index: usize, cfg: EncoderConfig, ) -> Result<Encoder<'static>, ConfigError>
Construct an encoder for message_index in set.
§impl Encoder<'static>
impl Encoder<'static>
pub fn with_registry(
set: &SchemaSet,
message_index: usize,
cfg: EncoderConfig,
registry: &PredictorRegistry,
) -> Result<Encoder<'static>, ConfigError>
pub fn with_registry( set: &SchemaSet, message_index: usize, cfg: EncoderConfig, registry: &PredictorRegistry, ) -> Result<Encoder<'static>, ConfigError>
Construct an encoder using an explicit runtime registry for custom models.
§impl<P> Encoder<'static, P>where
P: PredictorBuilder + 'static,
impl<P> Encoder<'static, P>where
P: PredictorBuilder + 'static,
pub fn with_predictors(
set: &SchemaSet,
message_index: usize,
cfg: EncoderConfig,
) -> Result<Encoder<'static, P>, ConfigError>
pub fn with_predictors( set: &SchemaSet, message_index: usize, cfg: EncoderConfig, ) -> Result<Encoder<'static, P>, ConfigError>
Construct an encoder with a custom predictor builder/set.
§impl<'a, P> Encoder<'a, P>where
P: PredictorBuilder + 'static,
impl<'a, P> Encoder<'a, P>where
P: PredictorBuilder + 'static,
pub fn with_storage(
schema: &SchemaRef<'_>,
message_index: usize,
cfg: EncoderConfig,
registry: Option<&PredictorRegistry>,
storage: EncoderStorage<'a, P>,
) -> Result<Encoder<'a, P>, ConfigError>
pub fn with_storage( schema: &SchemaRef<'_>, message_index: usize, cfg: EncoderConfig, registry: Option<&PredictorRegistry>, storage: EncoderStorage<'a, P>, ) -> Result<Encoder<'a, P>, 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.
pub 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.
pub 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>
pub 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.
pub 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.
pub 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.
pub 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.
pub 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.