Struct IdStore
struct IdStore<K, V> {
entries: Vec<(K, V)>,
}Expand description
A family’s inputs sorted by identity.
A sorted vector rather than a map: a store holds a handful of inputs, is written only by the binders, and is read on the resolution path by a borrowed identity — which a map keyed by the owned identity could not look up without allocating a key. A binary search over the borrowed identity’s own order costs nothing per lookup, and iteration is the identity’s order for free, which is the lift order.
Fields§
§entries: Vec<(K, V)>Implementations§
§impl<K: Ord, V> IdStore<K, V>
impl<K: Ord, V> IdStore<K, V>
fn insert(&mut self, id: K, value: V)
fn insert(&mut self, id: K, value: V)
Pins value under id, replacing what was pinned there.
fn get_by(&self, order: impl FnMut(&K) -> Ordering) -> Option<&V>
fn get_by(&self, order: impl FnMut(&K) -> Ordering) -> Option<&V>
The value pinned under the identity order places — how a borrowed
identity is looked up without building an owned key.
Trait Implementations§
impl<K: PartialEq, V: PartialEq> StructuralPartialEq for IdStore<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for IdStore<K, V>
impl<K, V> RefUnwindSafe for IdStore<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for IdStore<K, V>
impl<K, V> Sync for IdStore<K, V>
impl<K, V> Unpin for IdStore<K, V>
impl<K, V> UnsafeUnpin for IdStore<K, V>
impl<K, V> UnwindSafe for IdStore<K, V>where
K: UnwindSafe,
V: 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