Skip to main content

ContextStore

Struct ContextStore 

Source
pub struct ContextStore<A: AuIds = AuIds31, T = <A as AuIds>::Class>
where T: Copy + Ord + Hash,
{ /* 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>
where T: Copy + Ord + Hash,

Source

pub fn new() -> Self

Source

pub fn empty(&self) -> A::Context

Source

pub fn intern(&mut self, sorted_items: &[T]) -> A::Context

Source

pub fn get(&self, id: A::Context) -> &[T]

Source

pub fn contains(&self, id: A::Context, item: T) -> bool

Source

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).

Source

pub fn is_empty(&self) -> bool

Source

pub fn mark(&mut self) -> ContextStoreToken

Source

pub fn is_valid_token(&self, token: &ContextStoreToken) -> bool

Source

pub fn restore(&mut self, token: ContextStoreToken)

Trait Implementations§

Source§

impl<A: AuIds, T> Default for ContextStore<A, T>
where T: Copy + Ord + Hash,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<A, T> Freeze for ContextStore<A, T>
where AppendOnlyVec<Span<<A as AuIds>::ContextElem>, <A as AuIds>::Index>: Freeze, AppendOnlyVec<T, <A as AuIds>::Index>: Freeze, SpMap<Vec<T>, <A as AuIds>::Context, <A as AuIds>::Index>: Freeze,

§

impl<A, T> RefUnwindSafe for ContextStore<A, T>

§

impl<A, T> Send for ContextStore<A, T>
where AppendOnlyVec<Span<<A as AuIds>::ContextElem>, <A as AuIds>::Index>: Send, AppendOnlyVec<T, <A as AuIds>::Index>: Send, SpMap<Vec<T>, <A as AuIds>::Context, <A as AuIds>::Index>: Send,

§

impl<A, T> Sync for ContextStore<A, T>
where AppendOnlyVec<Span<<A as AuIds>::ContextElem>, <A as AuIds>::Index>: Sync, AppendOnlyVec<T, <A as AuIds>::Index>: Sync, SpMap<Vec<T>, <A as AuIds>::Context, <A as AuIds>::Index>: Sync,

§

impl<A, T> Unpin for ContextStore<A, T>
where AppendOnlyVec<Span<<A as AuIds>::ContextElem>, <A as AuIds>::Index>: Unpin, AppendOnlyVec<T, <A as AuIds>::Index>: Unpin, SpMap<Vec<T>, <A as AuIds>::Context, <A as AuIds>::Index>: Unpin,

§

impl<A, T> UnsafeUnpin for ContextStore<A, T>

§

impl<A, T> UnwindSafe for ContextStore<A, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.