pub struct HashMapCache<T, K = StdHashKey>{ /* private fields */ }Expand description
RewriteCache implemented with a HashMap, generic over a CacheKey hashing strategy.
Use HashMapCache<T> (defaults to StdHashKey) for standard Hash types,
or HashMapCache<T, CachedHashKey> for types implementing CacheHashable.
Implementations§
Trait Implementations§
Source§impl<T, K> Default for HashMapCache<T, K>
impl<T, K> Default for HashMapCache<T, K>
Source§impl<T, K> RewriteCache<T> for HashMapCache<T, K>
impl<T, K> RewriteCache<T> for HashMapCache<T, K>
Source§fn invalidate_node(&self, node: &T)
fn invalidate_node(&self, node: &T)
Invalidate any internally cached hash for the given node.
This is called on ancestors when a subtree is replaced.
The default implementation is a no-op for caches that don’t use node-level hash caching.
Source§fn invalidate_subtree(&self, node: &T)
fn invalidate_subtree(&self, node: &T)
Invalidate cached hashes for the given node and all its descendants.
Called on replacement subtrees after rule application.
Source§fn insert(&mut self, from: &T, to: Option<T>, level: usize)
fn insert(&mut self, from: &T, to: Option<T>, level: usize)
Insert the results into the cache.
Note: Any powerful side effects such as changing other parts of the tree or replacing the
root should NOT be inserted into the cache.
Source§fn push_ancestor(&mut self, node: &T)
fn push_ancestor(&mut self, node: &T)
Record the hash of an ancestor node before descending into a child.
Called by the zipper on every successful
go_down.Source§fn pop_ancestor(&mut self)
fn pop_ancestor(&mut self)
Discard the top ancestor hash after ascending back to a parent.
Called by the zipper on every
go_up during normal traversal.Source§fn pop_and_map_ancestor(&mut self, new_ancestor: &T, level: usize)
fn pop_and_map_ancestor(&mut self, new_ancestor: &T, level: usize)
Pop the top ancestor hash and insert a mapping from the old ancestor
to the new (rebuilt) ancestor at the given level.
Called by
mark_dirty_to_root as it walks up after a replacement.Auto Trait Implementations§
impl<T, K> Freeze for HashMapCache<T, K>
impl<T, K> RefUnwindSafe for HashMapCache<T, K>where
K: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, K> Send for HashMapCache<T, K>
impl<T, K> Sync for HashMapCache<T, K>
impl<T, K> Unpin for HashMapCache<T, K>
impl<T, K> UnsafeUnpin for HashMapCache<T, K>
impl<T, K> UnwindSafe for HashMapCache<T, K>where
K: UnwindSafe,
T: 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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 120 bytes