Struct IndexVec

Source
pub struct IndexVec<I, T>
where I: Idx,
{ /* private fields */ }

Implementations§

Source§

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

Source

pub fn new() -> Self

Source

pub fn with_capacity(cap: usize) -> Self

Source

pub fn from_elem<S>(elem: T, universe: &IndexVec<I, S>) -> Self
where T: Clone,

Source

pub fn from_elem_n(elem: T, n: usize) -> Self
where T: Clone,

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn into_iter(self) -> IntoIter<T>

Source

pub fn into_iter_enumerated(self) -> Enumerated<I, IntoIter<T>>

Source

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

Source

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

Source

pub fn iter_enumerated(&self) -> Enumerated<I, Iter<'_, T>>

Source

pub fn iter_enumerated_mut(&mut self) -> Enumerated<I, IterMut<'_, T>>

Source

pub fn indices(&self) -> Map<Range<usize>, IntoIdx<I>>

Source

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

Source

pub fn next_idx(&self) -> I

Source

pub fn shrink_to_fit(&mut self)

Source

pub fn swap(&mut self, l: I, r: I)

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub fn reserve(&mut self, s: usize)

Source

pub fn clear(&mut self)

Source

pub fn resize(&mut self, s: usize, v: T)
where T: Clone,

Source

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

Source

pub fn push_with_idx<F>(&mut self, f: F) -> I
where F: FnOnce(I) -> T,

Trait Implementations§

Source§

impl<I, T: Clone> Clone for IndexVec<I, T>
where I: Idx + Clone,

Source§

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

Returns a copy 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<I, T> Debug for IndexVec<I, T>
where I: Idx, T: Debug,

Source§

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

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

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

Source§

fn default() -> Self

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

impl<'de, I, T> Deserialize<'de> for IndexVec<I, T>
where I: Idx, T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

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

Source§

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

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, T> FromIterator<T> for IndexVec<I, T>
where I: Idx,

Source§

fn from_iter<IT>(iter: IT) -> Self
where IT: IntoIterator<Item = T>,

Creates a value from an iterator. Read more
Source§

impl<I, T: Hash> Hash for IndexVec<I, T>
where I: Idx + Hash,

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, T> Index<I> for IndexVec<I, T>
where I: Idx,

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, i: I) -> &T

Performs the indexing (container[index]) operation. Read more
Source§

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

Source§

fn index_mut(&mut self, i: I) -> &mut T

Performs the mutable indexing (container[index]) operation. Read more
Source§

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

Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, T>

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

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

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

Source§

type Item = &'a mut T

The type of the elements being iterated over.
Source§

type IntoIter = IterMut<'a, T>

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

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

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

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<T>

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

fn into_iter(self) -> IntoIter<T>

Creates an iterator from a value. Read more
Source§

impl<I, T: PartialEq> PartialEq for IndexVec<I, T>
where I: Idx + PartialEq,

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

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

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<I, T: Eq> Eq for IndexVec<I, T>
where I: Idx + Eq,

Source§

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

Source§

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

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 T: Sync,

§

impl<I, T> !Unpin for IndexVec<I, T>

§

impl<I, T> !UnwindSafe for IndexVec<I, 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> 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<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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,