Skip to main content

IndexVec

Struct IndexVec 

Source
#[repr(transparent)]
pub struct IndexVec<I, T> { pub raw: Vec<T>, /* private fields */ }
Expand description

An owned sequence of T indexed by I

Fields§

§raw: Vec<T>

Implementations§

Source§

impl<I: Idx, T> IndexVec<I, T>

Source

pub fn new() -> Self

Source

pub fn with_capacity(capacity: usize) -> Self

Source

pub fn from_raw(raw: Vec<T>) -> Self

Source

pub fn drain<R: RangeBounds<usize>>( &mut self, range: R, ) -> impl Iterator<Item = T> + '_

Source

pub fn truncate(&mut self, a: usize)

Source

pub fn as_slice(&self) -> &IndexSlice<I, T>

Source

pub fn as_mut_slice(&mut self) -> &mut IndexSlice<I, T>

Source

pub fn push(&mut self, data: T) -> I

Source

pub fn next_index(&self) -> I

Source

pub fn shrink_to_fit(&mut self)

Source

pub fn resize(&mut self, new_len: usize, value: T)
where T: Clone,

Methods from Deref<Target = IndexSlice<I, T>>§

Source

pub fn first(&self) -> Option<&T>

Source

pub fn last(&self) -> Option<&T>

Source

pub fn last_mut(&mut self) -> Option<&mut T>

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn iter(&self) -> Iter<'_, T>

Source

pub fn indices( &self, ) -> impl DoubleEndedIterator<Item = I> + ExactSizeIterator + Clone + 'static

Returns an iterator over the indices

Source

pub fn iter_enumerated( &self, ) -> impl DoubleEndedIterator<Item = (I, &T)> + ExactSizeIterator + '_

Source

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Source

pub fn iter_mut_enumerated( &mut self, ) -> impl DoubleEndedIterator<Item = (I, &mut T)> + ExactSizeIterator + '_

Source

pub fn last_index(&self) -> Option<I>

Source

pub fn swap(&mut self, a: I, b: I)

Source

pub fn get(&self, index: I) -> Option<&T>

Source

pub fn get_mut(&mut self, index: I) -> Option<&mut T>

Trait Implementations§

Source§

impl<I: Idx, T> Borrow<IndexSlice<I, T>> for IndexVec<I, T>

Source§

fn borrow(&self) -> &IndexSlice<I, T>

Immutably borrows from an owned value. Read more
Source§

impl<I: Idx, T> BorrowMut<IndexSlice<I, T>> for IndexVec<I, T>

Source§

fn borrow_mut(&mut self) -> &mut IndexSlice<I, T>

Mutably borrows from an owned value. Read more
Source§

impl<I: Clone, T: Clone> Clone for IndexVec<I, T>

Source§

fn clone(&self) -> IndexVec<I, T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<I, T> Debug for IndexVec<I, T>
where T: Debug,

Source§

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

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

impl<I: Idx, T> Default for IndexVec<I, T>

Source§

fn default() -> Self

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

impl<I: Idx, T> Deref for IndexVec<I, T>

Source§

type Target = IndexSlice<I, T>

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl<I: Idx, T> DerefMut for IndexVec<I, T>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<I: Eq, T: Eq> Eq for IndexVec<I, T>

Source§

impl<I, T> Extend<T> for IndexVec<I, T>

Source§

fn extend<Iter: IntoIterator<Item = T>>(&mut self, iter: Iter)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<I: Idx, T> From<IndexVec<I, T>> for FrozenIndexVec<I, T>

Source§

fn from(vec: IndexVec<I, T>) -> Self

Converts to this type from the input type.
Source§

impl<I: Idx, T, const N: usize> From<[T; N]> for IndexVec<I, T>

Source§

fn from(array: [T; N]) -> Self

Converts to this type from the input type.
Source§

impl<I: Idx, T> FromIterator<T> for IndexVec<I, T>

Source§

fn from_iter<Iter: IntoIterator<Item = T>>(iter: Iter) -> Self

Creates a value from an iterator. Read more
Source§

impl<I: GetSize, T: GetSize> GetSize for IndexVec<I, T>

Source§

fn get_heap_size(&self) -> usize

Determines how many bytes this object occupies inside the heap. Read more
Source§

fn get_heap_size_with_tracker<TRACKER: GetSizeTracker>( &self, tracker: TRACKER, ) -> (usize, TRACKER)

Determines how many bytes this object occupies inside the heap while using a tracker. Read more
Source§

fn get_stack_size() -> usize

Determines how may bytes this object occupies inside the stack. Read more
Source§

fn get_size(&self) -> usize

Determines the total size of the object. Read more
Source§

fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)
where T: GetSizeTracker,

Determines the total size of the object while using a tracker. Read more
Source§

impl<I: Hash, T: Hash> Hash for IndexVec<I, T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<I: Idx, T> IntoIterator for IndexVec<I, T>

Source§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
Source§

type Item = T

The type of the elements being iterated over.
Source§

fn into_iter(self) -> IntoIter<T>

Creates an iterator from a value. Read more
Source§

impl<'a, I: Idx, T> IntoIterator for &'a IndexVec<I, T>

Source§

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?
Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

fn into_iter(self) -> Iter<'a, T>

Creates an iterator from a value. Read more
Source§

impl<'a, I: Idx, T> IntoIterator for &'a mut IndexVec<I, T>

Source§

type IntoIter = IterMut<'a, T>

Which kind of iterator are we turning this into?
Source§

type Item = &'a mut T

The type of the elements being iterated over.
Source§

fn into_iter(self) -> IterMut<'a, T>

Creates an iterator from a value. Read more
Source§

impl<I: PartialEq, T: PartialEq> PartialEq for IndexVec<I, T>

Source§

fn eq(&self, other: &IndexVec<I, T>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<I: Idx, T> Send for IndexVec<I, T>
where T: Send,

Source§

impl<I: PartialEq, T: PartialEq> StructuralPartialEq for IndexVec<I, T>

Auto Trait Implementations§

§

impl<I, T> Freeze for IndexVec<I, T>

§

impl<I, T> RefUnwindSafe for IndexVec<I, T>

§

impl<I, T> Sync for IndexVec<I, T>
where I: Sync, T: Sync,

§

impl<I, T> Unpin for IndexVec<I, T>
where I: Unpin, T: Unpin,

§

impl<I, T> UnsafeUnpin for IndexVec<I, T>

§

impl<I, T> UnwindSafe for IndexVec<I, T>
where I: UnwindSafe, T: 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<I, C> CompactStringExt for C
where I: AsRef<str>, C: IntoIterator<Item = I>,

Source§

fn concat_compact(self) -> CompactString

Concatenates all the items of a collection into a CompactString Read more
Source§

fn join_compact<S>(self, separator: S) -> CompactString
where S: AsRef<str>,

Joins all the items of a collection, placing a separator between them, forming a CompactString Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

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

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

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

Compare self to key and return true if they are equal.
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.