pub struct LatticeCache { /* private fields */ }Expand description
Thread-safe cache for Pythagorean lattices.
Uses Arc<RwLock> for safe concurrent access.
The cache automatically evicts old entries when capacity is reached.
Implementations§
Source§impl LatticeCache
impl LatticeCache
Sourcepub fn with_default_capacity() -> Self
pub fn with_default_capacity() -> Self
Create a cache with default capacity (32 lattices).
Sourcepub fn get_or_compute(&self, density: usize) -> CachedLattice
pub fn get_or_compute(&self, density: usize) -> CachedLattice
Sourcepub fn precompute(&self, densities: &[usize])
pub fn precompute(&self, densities: &[usize])
Precompute and cache lattices for common densities.
§Arguments
densities- Slice of density values to precompute
§Example
use constraint_theory_core::cache::LatticeCache;
let cache = LatticeCache::new(10);
cache.precompute(&[50, 100, 200]);
assert!(cache.contains(50));
assert!(cache.contains(100));
assert!(cache.contains(200));Trait Implementations§
Source§impl Clone for LatticeCache
impl Clone for LatticeCache
Source§fn clone(&self) -> LatticeCache
fn clone(&self) -> LatticeCache
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LatticeCache
impl Debug for LatticeCache
Auto Trait Implementations§
impl Freeze for LatticeCache
impl RefUnwindSafe for LatticeCache
impl Send for LatticeCache
impl Sync for LatticeCache
impl Unpin for LatticeCache
impl UnsafeUnpin for LatticeCache
impl UnwindSafe for LatticeCache
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