Struct rustc_index::vec::IndexVec [−][src]
pub struct IndexVec<I: Idx, T> {
pub raw: Vec<T>,
_marker: PhantomData<fn(_: &I)>,
}
Fields
raw: Vec<T>
_marker: PhantomData<fn(_: &I)>
Implementations
Create an IndexVec
with n
elements, where the value of each
element is the result of func(i)
. (The underlying vector will
be allocated only once, with a capacity of at least n
.)
Gives the next index that will be assigned when push
is
called.
pub fn into_iter_enumerated(
self
) -> impl DoubleEndedIterator<Item = (I, T)> + ExactSizeIterator
pub fn iter_enumerated(
&self
) -> impl DoubleEndedIterator<Item = (I, &T)> + ExactSizeIterator + '_
pub fn iter_enumerated_mut(
&mut self
) -> impl DoubleEndedIterator<Item = (I, &mut T)> + ExactSizeIterator + '_
pub fn drain<'a, R: RangeBounds<usize>>(
&'a mut self,
range: R
) -> impl Iterator<Item = T> + 'a
pub fn drain_enumerated<'a, R: RangeBounds<usize>>(
&'a mut self,
range: R
) -> impl Iterator<Item = (I, T)> + 'a
Returns mutable references to two distinct elements, a and b. Panics if a == b.
Returns mutable references to three distinct elements or panics otherwise.
Grows the index vector so that it contains an entry for
elem
; if that is already true, then has no
effect. Otherwise, inserts new values as needed by invoking
fill_value
.
IndexVec
is often used as a map, so it provides some map-like APIs.
Trait Implementations
Extends a collection with the contents of an iterator. Read more
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Creates a value from an iterator. Read more
Auto Trait Implementations
impl<I, T> RefUnwindSafe for IndexVec<I, T> where
T: RefUnwindSafe,
impl<I, T> UnwindSafe for IndexVec<I, T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes