pub struct QueryCache<R> {
entries: FxHashMap<String, QueryVal<R>>,
}Fields§
§entries: FxHashMap<String, QueryVal<R>>Implementations§
Source§impl<R> QueryCache<R>
impl<R> QueryCache<R>
pub fn new() -> Self
pub fn insert(&mut self, key: String, constr_hash: u64, result: R)
pub fn lookup(&self, key: &String, constr_hash: u64) -> Option<&R>
Sourcepub fn lookup_by_key(&self, key: &str) -> Option<&R>
pub fn lookup_by_key(&self, key: &str) -> Option<&R>
Look up a result by key only (no hash validation).
Sourcepub fn update_result_by_key(&mut self, key: &str, f: impl FnOnce(&mut R))
pub fn update_result_by_key(&mut self, key: &str, f: impl FnOnce(&mut R))
Mutate a cached result by key only (no hash validation).
fn path() -> Result<&'static Path, Error>
fn no_cache_err() -> Error
Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for QueryCache<R>
impl<R> RefUnwindSafe for QueryCache<R>where
R: RefUnwindSafe,
impl<R> Send for QueryCache<R>where
R: Send,
impl<R> Sync for QueryCache<R>where
R: Sync,
impl<R> Unpin for QueryCache<R>where
R: Unpin,
impl<R> UnwindSafe for QueryCache<R>where
R: UnwindSafe,
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