Skip to main content

Caching

Trait Caching 

Source
pub trait Caching {
    // Required methods
    fn init(&mut self) -> Index;
    fn root_index(&mut self) -> Index;
    fn root(&self) -> Option<&CacheEntry>;
    fn insert(&mut self, path: &[usize], cover: &Cover) -> Index;
    fn find(&self, path: &[usize], cover: &Cover) -> Option<&CacheEntry>;
    fn keyed_by_cover(&self) -> bool;
    fn node(&self, key: &CacheKey) -> Option<&CacheEntry>;
    fn contains(&self, key: &CacheKey) -> bool;
    fn update_root(&mut self) -> Option<CacheEntryUpdater<'_>>;
    fn update_node(&mut self, key: &CacheKey) -> Option<CacheEntryUpdater<'_>>;
    fn size(&self) -> usize;
    fn is_empty(&self) -> bool;
}
Expand description

A cache of subproblems. Lookups take the sorted itemset of the path and cover, positioned on the instances of that path.

Required Methods§

Source

fn init(&mut self) -> Index

Clears the cache and creates the root entry.

Source

fn root_index(&mut self) -> Index

Index of the root entry.

Source

fn root(&self) -> Option<&CacheEntry>

The root entry.

Source

fn insert(&mut self, path: &[usize], cover: &Cover) -> Index

Finds the entry of the subproblem, creating it if needed. The index is New for an entry that has not been evaluated yet.

Source

fn find(&self, path: &[usize], cover: &Cover) -> Option<&CacheEntry>

The entry of the subproblem, if cached.

Source

fn keyed_by_cover(&self) -> bool

Whether lookups use cover.

Source

fn node(&self, key: &CacheKey) -> Option<&CacheEntry>

The entry for key.

Source

fn contains(&self, key: &CacheKey) -> bool

Whether the cache has an entry for key.

Source

fn update_root(&mut self) -> Option<CacheEntryUpdater<'_>>

An updater for the root entry.

Source

fn update_node(&mut self, key: &CacheKey) -> Option<CacheEntryUpdater<'_>>

An updater for the entry of key.

Source

fn size(&self) -> usize

Number of entries.

Source

fn is_empty(&self) -> bool

Whether the cache has no entry.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§