Struct IntIndex

Source
pub struct IntIndex<K = i32, X = usize> { /* private fields */ }
Expand description

Key is from type Into: i32.

Trait Implementations§

Source§

impl<K: Debug, X: Debug> Debug for IntIndex<K, X>

Source§

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

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

impl<K, X> Filterable for IntIndex<K, X>
where K: Into<i32> + TryInto<usize> + Copy,

Source§

type Key = K

Source§

type Index = X

Source§

fn get(&self, key: &Self::Key) -> &[X]

Get all indices for a given Key. If the Key not exist, than this method returns empty array.
Source§

fn contains(&self, key: &Self::Key) -> bool

Checks whether the Key exists.
Source§

fn get_with_check<F>(&self, key: &Self::Key, check: F) -> &[Self::Index]
where F: Fn(&Self::Key) -> bool,

Get all indices for a given Key, if the check functions returns true. If the Key not exist, than this method returns empty array.
Source§

fn get_many<'k, K>( &'k self, keys: K, ) -> Many<'k, Self, <K as IntoIterator>::IntoIter>
where K: IntoIterator<Item = Self::Key> + 'k, Self: Sized,

Combined all given keys with an logical OR. Read more
Source§

impl<K> Keys for IntIndex<K>
where K: Into<i32> + TryInto<usize> + Ord + Default + Copy,

Source§

type Key = K

Source§

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

Checks if the Keyexist.
Source§

fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Self::Key> + 'a>

Return all known Keys.
Source§

fn from_iter<I>(it: I) -> Self
where I: IntoIterator<Item = K>,

Create a new Key-Store from a given List of Keys.
Source§

impl<K, X> MetaData for IntIndex<K, X>

Source§

type Meta<'m> = IntMeta<'m, K, X> where K: 'm, X: 'm

Source§

fn meta(&self) -> Self::Meta<'_>

Return meta data from the Store.
Source§

impl<K, X> Store for IntIndex<K, X>
where K: Into<i32> + TryInto<usize> + Ord + Default + Copy, X: Ord + Clone,

Source§

fn insert(&mut self, key: K, x: X)

Insert an Key for a given Index. Read more
Source§

fn delete(&mut self, key: K, x: &X)

Delete means: if an Key has more than one Index, then remove only this Index: Read more
Source§

fn with_capacity(capacity: usize) -> Self

To reduce memory allocations can create an Index-store with capacity.
Source§

fn update(&mut self, old_key: Self::Key, idx: Self::Index, new_key: Self::Key)

Update means: Key changed, but Index stays the same Read more
Source§

fn from_list<I>(it: I) -> Self
where I: IntoIterator<Item = Self::Key>, <I as IntoIterator>::IntoIter: ExactSizeIterator, Self: Store<Index = usize> + Sized,

Create a new Store from a given List (array, slice, Vec, …) with a given Key. The Index-Type is usize.
Source§

fn from_map<I>(it: I) -> Self
where I: IntoIterator<Item = (Self::Key, Self::Index)> + ExactSizeIterator, Self: Sized,

Create a new Store from a given Map (Key-Index-Pair).

Auto Trait Implementations§

§

impl<K, X> Freeze for IntIndex<K, X>
where K: Freeze,

§

impl<K, X> RefUnwindSafe for IntIndex<K, X>

§

impl<K, X> Send for IntIndex<K, X>
where K: Send, X: Send,

§

impl<K, X> Sync for IntIndex<K, X>
where K: Sync, X: Sync,

§

impl<K, X> Unpin for IntIndex<K, X>
where K: Unpin, X: Unpin,

§

impl<K, X> UnwindSafe for IntIndex<K, X>
where K: UnwindSafe, X: 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> 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 = 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.