pub trait CacheKey:
Hash
+ Eq
+ Clone
+ Send
+ Sync
+ 'static {
const BITS_COUNT: u32;
const ZERO: Self;
const ONE: Self;
// Required methods
fn from_usize(v: usize) -> Self;
fn checked_mul(self, rhs: Self) -> Option<Self>;
fn wrapping_add(self, rhs: Self) -> Self;
}Expand description
Trait for cache key types used in flat-index computation.
Built-in implementations are provided for u64, u128, U256, U512,
and U1024. For index spaces larger than 1024 bits, implement this trait
for a wider integer type and use
CachedFunction::with_key_type.
See module documentation for a complete custom key example.
Required Associated Constants§
Sourceconst BITS_COUNT: u32
const BITS_COUNT: u32
Number of bits this key type can represent.
Required Methods§
Sourcefn from_usize(v: usize) -> Self
fn from_usize(v: usize) -> Self
Convert a usize to this key type.
Sourcefn checked_mul(self, rhs: Self) -> Option<Self>
fn checked_mul(self, rhs: Self) -> Option<Self>
Checked multiplication. Returns None on overflow.
Sourcefn wrapping_add(self, rhs: Self) -> Self
fn wrapping_add(self, rhs: Self) -> Self
Wrapping addition (overflow wraps around).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".