pub struct MemoKey {
pub expr_fingerprint: u64,
pub input_hash: u64,
}Expand description
Key for memoized results.
Combines an expression fingerprint (structural identity of a TLExpr) with
a hash over concrete input values so that two calls sharing the same graph
shape but with different data produce distinct cache keys.
Fields§
§expr_fingerprint: u64Structural fingerprint of the expression graph.
input_hash: u64Hash of the concrete input values (0 when inputs are not considered).
Implementations§
Source§impl MemoKey
impl MemoKey
Sourcepub fn new(expr_fingerprint: u64, input_hash: u64) -> Self
pub fn new(expr_fingerprint: u64, input_hash: u64) -> Self
Construct a MemoKey directly from its two components.
Sourcepub fn from_expr_and_hash(expr: &TLExpr, input_hash: u64) -> Self
pub fn from_expr_and_hash(expr: &TLExpr, input_hash: u64) -> Self
Build a key from a TLExpr plus a pre-computed input hash.
Sourcepub fn hash_inputs(inputs: &[f64]) -> u64
pub fn hash_inputs(inputs: &[f64]) -> u64
Compute an FNV-1a hash over a slice of f64 values.
The result can be supplied as input_hash when constructing a MemoKey
so that semantically identical graphs but with different numeric inputs
map to different cache entries.
Trait Implementations§
impl Eq for MemoKey
impl StructuralPartialEq for MemoKey
Auto Trait Implementations§
impl Freeze for MemoKey
impl RefUnwindSafe for MemoKey
impl Send for MemoKey
impl Sync for MemoKey
impl Unpin for MemoKey
impl UnsafeUnpin for MemoKey
impl UnwindSafe for MemoKey
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more