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: usizeImplementations§
Source§impl OpaqueHoldLast
impl OpaqueHoldLast
pub fn new() -> Self
pub fn update(&mut self, value: Value)
pub fn reset(&mut self)
pub fn predict(&self) -> Option<&Value>
pub fn matches(&self, value: &Value) -> bool
pub fn state_hash(&self) -> u64
Sourcepub fn configure_opaque_pool(&mut self, word_off: usize, byte_off: usize)
pub fn configure_opaque_pool(&mut self, word_off: usize, byte_off: usize)
Configure the fixed pool slot used by this predictor instance.
pub fn as_ref<'a>( &self, words: &'a [u64], bytes: &'a [u8], ) -> Option<OpaqueRef<'a>>
pub fn matches_ref( &self, value: OpaqueRef<'_>, words: &[u64], bytes: &[u8], ) -> bool
pub fn update_ref( &mut self, value: OpaqueRef<'_>, words: &mut [u64], bytes: &mut [u8], ) -> bool
pub fn state_hash_pool(&self, words: &[u64], bytes: &[u8]) -> u64
pub fn predict_value(&self, words: &[u64], bytes: &[u8]) -> Option<Value>
pub fn update_value( &mut self, value: &Value, words: &mut [u64], bytes: &mut [u8], )
Trait Implementations§
Source§impl Debug for OpaqueHoldLast
impl Debug for OpaqueHoldLast
Source§impl Default for OpaqueHoldLast
impl Default for OpaqueHoldLast
Source§impl Predictor for OpaqueHoldLast
impl Predictor for OpaqueHoldLast
Source§fn update(&mut self, _t: u64, _x: f64) -> Result<(), PredictorError>
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>
fn predict(&self, _t: u64) -> Option<f64>
Predict value at time
t. Must not mutate predictor state.Source§fn state_hash(&self) -> u64
fn state_hash(&self) -> u64
Deterministic hash of predictor state.
Auto Trait Implementations§
impl Freeze for OpaqueHoldLast
impl RefUnwindSafe for OpaqueHoldLast
impl Send for OpaqueHoldLast
impl Sync for OpaqueHoldLast
impl Unpin for OpaqueHoldLast
impl UnsafeUnpin for OpaqueHoldLast
impl UnwindSafe for OpaqueHoldLast
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more