Skip to main content

OpaqueHoldLast

Struct OpaqueHoldLast 

Source
pub struct OpaqueHoldLast {
    pub kind: Option<OpaqueKind>,
    pub word_off: usize,
    pub byte_off: usize,
    pub len: usize,
    /* private fields */
}
Expand description

Hold-last predictor for bool, enum, string and list fields. Alloc mode keeps owned Value for compatibility; pool fields enable no-alloc migration.

Fields§

§kind: Option<OpaqueKind>§word_off: usize§byte_off: usize§len: usize

Implementations§

Source§

impl OpaqueHoldLast

Source

pub fn new() -> Self

Source

pub fn update(&mut self, value: Value)

Source

pub fn reset(&mut self)

Source

pub fn predict(&self) -> Option<&Value>

Source

pub fn matches(&self, value: &Value) -> bool

Source

pub fn state_hash(&self) -> u64

Source

pub fn configure_opaque_pool(&mut self, word_off: usize, byte_off: usize)

Configure the fixed pool slot used by this predictor instance.

Source

pub fn as_ref<'a>( &self, words: &'a [u64], bytes: &'a [u8], ) -> Option<OpaqueRef<'a>>

Source

pub fn matches_ref( &self, value: OpaqueRef<'_>, words: &[u64], bytes: &[u8], ) -> bool

Source

pub fn update_ref( &mut self, value: OpaqueRef<'_>, words: &mut [u64], bytes: &mut [u8], ) -> bool

Source

pub fn state_hash_pool(&self, words: &[u64], bytes: &[u8]) -> u64

Source

pub fn predict_value(&self, words: &[u64], bytes: &[u8]) -> Option<Value>

Source

pub fn update_value( &mut self, value: &Value, words: &mut [u64], bytes: &mut [u8], )

Trait Implementations§

Source§

impl Debug for OpaqueHoldLast

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for OpaqueHoldLast

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Predictor for OpaqueHoldLast

Source§

fn reset(&mut self)

Reset predictor state to its initial value.
Source§

fn update(&mut self, _t: u64, _x: f64) -> Result<(), PredictorError>

Update predictor with a sample at time t and value x.
Source§

fn predict(&self, _t: u64) -> Option<f64>

Predict value at time t. Must not mutate predictor state.
Source§

fn state_hash(&self) -> u64

Deterministic hash of predictor state.

Auto Trait Implementations§

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.