Struct containers::collections::Vec
[−]
[src]
pub struct Vec<T, A: Alloc = NullAllocator> { /* fields omitted */ }
Growable array
Methods
impl<T, A: Alloc> Vec<T, A>
[src]
fn new_in(a: A) -> Vec<T, A>
[src]
Make a new array.
fn with_capacity_in(a: A, cap: usize) -> Option<Vec<T, A>>
[src]
Make a new array with enough room to hold at least cap
elements.
Failures
Returns None
if allocation fails.
unsafe fn set_length(&mut self, len: usize)
[src]
fn capacity(&self) -> usize
[src]
Return number of elements array can hold before reallocation.
unsafe fn storage_mut(&mut self) -> &mut [T]
[src]
fn reserve(&mut self, n_more: usize) -> bool
[src]
Make sure the array has enough room for at least n_more
more elements, reallocating if need be.
Failures
Returns false
if allocation fails, true
otherwise.
fn relinquish(&mut self) -> bool
[src]
Relinquish memory so capacity = length.
fn insert(&mut self, k: usize, x: T) -> Result<(), T>
[src]
Insert element x
at position k
, shifting elements after k
aftward one position to make room.
Failures
Returns Err(x)
if allocation fails.
Panics
Panics if k
is out of bounds.
fn delete(&mut self, k: usize) -> T
[src]
Delete element at position k
and return it, shifting elements after k
forward one position to fill the gap.
Panics
Panics if k
is out of bounds.
fn delete_swap_last(&mut self, k: usize) -> T
[src]
Delete element at position k
and move the last element into the gap.
Panics
Panics if k
is out of bounds.
fn push(&mut self, x: T) -> Result<(), T>
[src]
fn pop(&mut self) -> Option<T>
[src]
Pop last element off end of array.
Return None
if array empty.
fn append<B: Alloc>(&mut self, xs: Vec<T, B>) -> Result<(), Vec<T, B>>
[src]
Append xs
to the array.
Failures
Returns Err(xs)
if allocation fails, in which case both self
and xs
are unmodified.
fn append_slice(&mut self, xs: &[T]) -> bool where
T: Copy,
[src]
T: Copy,
Copy xs
and append it to the array.
Failures
Returns false
if allocation fails, in which case self
is unmodified.
fn extend<Ts: IntoIterator<Item = T>>(
&mut self,
xs: Ts
) -> Result<(), Ts::IntoIter>
[src]
&mut self,
xs: Ts
) -> Result<(), Ts::IntoIter>
Add elements of xs
to aft end of array.
Failures
Returns Err
of remainder of xs
if allocation fails.
fn from_iter_in<Ts: IntoIterator<Item = T>>(
a: A,
xs: Ts
) -> Result<Self, Ts::IntoIter>
[src]
a: A,
xs: Ts
) -> Result<Self, Ts::IntoIter>
Add elements of xs
to aft end of array.
Failures
Returns Err
of remainder of xs
if allocation fails, in which case some elements may have been added to xs
already.
fn truncate(&mut self, len: usize)
[src]
Shorten array to len
and drop elements beyond.
fn from_raw(raw: RawVec<T, A>) -> Self
[src]
impl<T, A: Alloc + Default> Vec<T, A>
[src]
fn new() -> Self
[src]
Make a new array.
fn with_capacity(cap: usize) -> Option<Self>
[src]
Make a new array with enough room to hold at least cap
elements.
Failures
Returns None
if allocation fails.
fn from_iter<Ts: IntoIterator<Item = T>>(xs: Ts) -> Result<Self, Ts::IntoIter>
[src]
Add elements of xs
to aft end of array.
Failures
Returns Err
of remainder of xs
if allocation fails, in which case some elements may have been added to xs
already.
impl<T, A: Alloc + TryClone> Vec<T, A>
[src]
Trait Implementations
impl<T: TryClone, A: Alloc + TryClone> TryClone for Vec<T, A>
[src]
type Error = Option<Either<A::Error, T::Error>>
fn try_clone(&self) -> Result<Self, Self::Error>
[src]
fn try_clone_from(&mut self, other: &Self) -> Result<(), Self::Error>
[src]
impl<T, A: Alloc> Drop for Vec<T, A>
[src]
impl<T, A: Alloc + Default> Default for Vec<T, A>
[src]
impl<T: PartialEq, A: Alloc> PartialEq for Vec<T, A>
[src]
fn eq(&self, other: &Self) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<T: PartialOrd, A: Alloc> PartialOrd for Vec<T, A>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T: Eq, A: Alloc> Eq for Vec<T, A>
[src]
impl<T: Ord, A: Alloc> Ord for Vec<T, A>
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.22.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.22.0[src]
Compares and returns the minimum of two values. Read more
impl<T, A: Alloc> Index<usize> for Vec<T, A>
[src]
type Output = <[T] as Index<usize>>::Output
The returned type after indexing.
fn index(&self, k: usize) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl<T, A: Alloc> IndexMut<usize> for Vec<T, A>
[src]
fn index_mut(&mut self, k: usize) -> &mut Self::Output
[src]
Performs the mutable indexing (container[index]
) operation.
impl<T, A: Alloc> Index<Range<usize>> for Vec<T, A>
[src]
type Output = <[T] as Index<Range<usize>>>::Output
The returned type after indexing.
fn index(&self, k: Range<usize>) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl<T, A: Alloc> IndexMut<Range<usize>> for Vec<T, A>
[src]
fn index_mut(&mut self, k: Range<usize>) -> &mut Self::Output
[src]
Performs the mutable indexing (container[index]
) operation.
impl<T, A: Alloc> Index<RangeTo<usize>> for Vec<T, A>
[src]
type Output = <[T] as Index<RangeTo<usize>>>::Output
The returned type after indexing.
fn index(&self, k: RangeTo<usize>) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl<T, A: Alloc> IndexMut<RangeTo<usize>> for Vec<T, A>
[src]
fn index_mut(&mut self, k: RangeTo<usize>) -> &mut Self::Output
[src]
Performs the mutable indexing (container[index]
) operation.
impl<T, A: Alloc> Index<RangeFrom<usize>> for Vec<T, A>
[src]
type Output = <[T] as Index<RangeFrom<usize>>>::Output
The returned type after indexing.
fn index(&self, k: RangeFrom<usize>) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl<T, A: Alloc> IndexMut<RangeFrom<usize>> for Vec<T, A>
[src]
fn index_mut(&mut self, k: RangeFrom<usize>) -> &mut Self::Output
[src]
Performs the mutable indexing (container[index]
) operation.
impl<T, A: Alloc> Index<RangeFull> for Vec<T, A>
[src]
type Output = <[T] as Index<RangeFull>>::Output
The returned type after indexing.
fn index(&self, k: RangeFull) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl<T, A: Alloc> IndexMut<RangeFull> for Vec<T, A>
[src]
fn index_mut(&mut self, k: RangeFull) -> &mut Self::Output
[src]
Performs the mutable indexing (container[index]
) operation.
impl<T, A: Alloc> Borrow<[T]> for Vec<T, A>
[src]
impl<T, A: Alloc> BorrowMut<[T]> for Vec<T, A>
[src]
fn borrow_mut(&mut self) -> &mut [T]
[src]
Mutably borrows from an owned value. Read more
impl<T, A: Alloc> Deref for Vec<T, A>
[src]
type Target = [T]
The resulting type after dereferencing.
fn deref(&self) -> &[T]
[src]
Dereferences the value.
impl<T, A: Alloc> DerefMut for Vec<T, A>
[src]
impl<T: Hash, A: Alloc> Hash for Vec<T, A>
[src]
fn hash<H: Hasher>(&self, h: &mut H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T: Debug, A: Alloc> Debug for Vec<T, A>
[src]
impl<T, A: Alloc> IntoIterator for Vec<T, A>
[src]
type Item = T
The type of the elements being iterated over.
type IntoIter = IntoIter<T, A>
Which kind of iterator are we turning this into?
fn into_iter(self) -> IntoIter<T, A>
[src]
Creates an iterator from a value. Read more
impl<'a, T, A: Alloc> IntoIterator for &'a Vec<T, A>
[src]
type Item = &'a T
The type of the elements being iterated over.
type IntoIter = Iter<'a, T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Iter<'a, T>
[src]
Creates an iterator from a value. Read more