pub struct ContextStore<A: AuIds = AuIds31, T = <A as AuIds>::Class>{ /* private fields */ }Expand description
Interns sorted context-item vectors as context ids. Two equal vectors get the same context id; comparison is then a single integer compare.
Both pools and the dedup map are addressed by ids whose Index is A::Index
(A::Context for spans, A::ContextElem for items, and index’s log
positions are what A::Contexts are minted from), so that word is the index type
rather than usize.
Implementations§
Source§impl<A: AuIds, T> ContextStore<A, T>
impl<A: AuIds, T> ContextStore<A, T>
pub fn new() -> Self
pub fn empty(&self) -> A::Context
pub fn intern(&mut self, sorted_items: &[T]) -> A::Context
pub fn get(&self, id: A::Context) -> &[T]
pub fn contains(&self, id: A::Context, item: T) -> bool
Sourcepub fn len(&self) -> A::Index
pub fn len(&self) -> A::Index
Number of interned contexts, in the configured index word (a context count is a position count: the next context interns at exactly this index).
pub fn is_empty(&self) -> bool
pub fn mark(&mut self) -> ContextStoreToken
pub fn is_valid_token(&self, token: &ContextStoreToken) -> bool
pub fn restore(&mut self, token: ContextStoreToken)
Trait Implementations§
Auto Trait Implementations§
impl<A, T> Freeze for ContextStore<A, T>
impl<A, T> RefUnwindSafe for ContextStore<A, T>where
AppendOnlyVec<Span<<A as AuIds>::ContextElem>, <A as AuIds>::Index>: RefUnwindSafe,
AppendOnlyVec<T, <A as AuIds>::Index>: RefUnwindSafe,
SpMap<Vec<T>, <A as AuIds>::Context, <A as AuIds>::Index>: RefUnwindSafe,
impl<A, T> Send for ContextStore<A, T>
impl<A, T> Sync for ContextStore<A, T>
impl<A, T> Unpin for ContextStore<A, T>
impl<A, T> UnsafeUnpin for ContextStore<A, T>where
AppendOnlyVec<Span<<A as AuIds>::ContextElem>, <A as AuIds>::Index>: UnsafeUnpin,
AppendOnlyVec<T, <A as AuIds>::Index>: UnsafeUnpin,
SpMap<Vec<T>, <A as AuIds>::Context, <A as AuIds>::Index>: UnsafeUnpin,
impl<A, T> UnwindSafe for ContextStore<A, T>where
AppendOnlyVec<Span<<A as AuIds>::ContextElem>, <A as AuIds>::Index>: UnwindSafe,
AppendOnlyVec<T, <A as AuIds>::Index>: UnwindSafe,
SpMap<Vec<T>, <A as AuIds>::Context, <A as AuIds>::Index>: 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