IndexStore

Struct IndexStore 

Source
pub struct IndexStore<K, P>(/* private fields */);
Expand description

Key is from type usize and the information are saved in a List (Store).

Methods from Deref<Target = IndexStoreExt<K, P>>§

Source

pub fn keys(&self) -> impl Iterator<Item = K> + '_

Returns all stored Keys.

Source

pub fn min_key(&self) -> Option<K>

Returns smallest stored Key.

Source

pub fn max_key(&self) -> Option<K>

Returns greatest stored Key.

Trait Implementations§

Source§

impl<K: Clone, P: Clone> Clone for IndexStore<K, P>

Source§

fn clone(&self) -> IndexStore<K, P>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<K: Debug, P: Debug> Debug for IndexStore<K, P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<K, P> Deref for IndexStore<K, P>

Source§

type Target = IndexStoreExt<K, P>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<K, P> Lookup<IndexStore<K, P>, P> for IndexLookup<K, P>
where K: Into<usize> + Clone, P: KeyPosition + Clone,

Source§

fn new() -> Self

Source§

fn with_key<K>() -> Self
where K: KeyPosition, Self: Lookup<S, K> + Sized,

Source§

fn with_unique_key() -> Self
where P::Pos: PartialEq, Self: Lookup<S, UniqueKeyPosition<P::Pos>> + Sized,

Source§

fn with_multi_keys() -> Self
where P::Pos: Ord, Self: Lookup<S, MultiKeyPosition<P::Pos>> + Sized,

Source§

fn new_list_store<'a, F, K, It, I: 'a>(&self, field: &F, it: It) -> S
where It: Iterator<Item = &'a I> + ExactSizeIterator, F: Fn(&I) -> K, S: Store<Key = K, Pos = usize>,

Create a new Store for a collection from type list (e.g. LkupVec). The Pos-Type is always usize.
Source§

fn new_map_store<'a, F, K, It, I: 'a>(&self, field: &F, it: It) -> S
where It: Iterator<Item = (&'a P::Pos, &'a I)> + ExactSizeIterator, F: Fn(&I) -> K, S: Store<Key = K, Pos = P::Pos>, P::Pos: Clone + 'a,

Create a new Store for a collection from type map (e.g. LkupHashMap).
Source§

impl<'a, K, P> Positions for IndexStore<K, &'a P>

Source§

type Pos = <P as KeyPositionAsSlice>::Pos

Source§

fn positions(&self) -> impl Iterator<Item = &P::Pos>

Returns all knwon positions as an iterator.
Source§

impl<K, P> Retriever<K> for IndexStore<K, P>

Source§

type Pos = <P as KeyPositionAsSlice>::Pos

Source§

fn key_exist(&self, key: K) -> bool

Check, that the given key exist.
Source§

fn pos_by_key(&self, key: K) -> &[Self::Pos]

Returns all known positions for a given Key. If the Key not exist, than is the slice empty.
Source§

fn pos_by_many_keys<'a, K>( &'a self, keys: K, ) -> impl Iterator<Item = &'a Self::Pos>
where K: IntoIterator<Item = Q>, Self::Pos: 'a,

Returns all known positions for a given iterator of Keys. Read more
Source§

impl<K, P> Store for IndexStore<K, P>
where K: Into<usize> + Clone, P: KeyPosition + Clone,

Source§

type Key = K

Source§

type Pos = <P as KeyPosition>::Pos

Source§

fn insert(&mut self, key: Self::Key, pos: Self::Pos)

Insert an Key with the associated Positions.
Source§

fn delete(&mut self, key: Self::Key, pos: &Self::Pos)

Delete means: if an Key has more than one Position, then remove only the given Position: If the Key not exist, then is deleteignored:
Source§

fn with_capacity(capacity: usize) -> Self

To reduce memory allocations can create an Store with capacity.
Source§

fn update(&mut self, old_key: Self::Key, pos: Self::Pos, new_key: Self::Key)

Update means: Key changed, but Position stays the same.
Source§

impl<'a, K, P> ViewCreator<'a> for IndexStore<K, P>
where K: Into<usize> + Clone, P: KeyPositionAsSlice + 'a,

Source§

type Key = K

Source§

type Retriever = IndexStore<K, &'a P>

Source§

fn create_view<It>(&'a self, keys: It) -> View<Self::Retriever>
where It: IntoIterator<Item = Self::Key>,

Create a View by the given Keys.

Auto Trait Implementations§

§

impl<K, P> Freeze for IndexStore<K, P>

§

impl<K, P> RefUnwindSafe for IndexStore<K, P>

§

impl<K, P> Send for IndexStore<K, P>
where K: Send, P: Send,

§

impl<K, P> Sync for IndexStore<K, P>
where K: Sync, P: Sync,

§

impl<K, P> Unpin for IndexStore<K, P>
where K: Unpin, P: Unpin,

§

impl<K, P> UnwindSafe for IndexStore<K, P>
where K: UnwindSafe, P: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.