Struct sized_vec::Vec [−][src]
pub struct Vec<N, A> where
N: Unsigned, { /* fields omitted */ }
A vector of length N
containing elements of type A
.
Methods
impl<A> Vec<U0, A>
[src]
impl<A> Vec<U0, A>
impl<N, A> Vec<N, A> where
N: Unsigned,
[src]
impl<N, A> Vec<N, A> where
N: Unsigned,
pub fn push(self, a: A) -> Vec<Add1<N>, A> where
N: Add<B1>,
Add1<N>: Unsigned,
[src]
pub fn push(self, a: A) -> Vec<Add1<N>, A> where
N: Add<B1>,
Add1<N>: Unsigned,
Push an element onto the end of the vector.
pub fn pop(self) -> (Vec<Diff<N, U1>, A>, A) where
N: Sub<U1>,
Diff<N, U1>: Unsigned,
[src]
pub fn pop(self) -> (Vec<Diff<N, U1>, A>, A) where
N: Sub<U1>,
Diff<N, U1>: Unsigned,
Pop an element off the end of the vector.
pub fn insert<Index>(self, _: Index, a: A) -> Vec<Add1<N>, A> where
Index: Unsigned + IsLess<N>,
Le<Index, N>: IsTrue,
N: Add<B1>,
Add1<N>: Unsigned,
[src]
pub fn insert<Index>(self, _: Index, a: A) -> Vec<Add1<N>, A> where
Index: Unsigned + IsLess<N>,
Le<Index, N>: IsTrue,
N: Add<B1>,
Add1<N>: Unsigned,
Insert an element into the vector at index Index
.
pub fn remove<Index>(self, _: Index) -> (Vec<Sub1<N>, A>, A) where
Index: Unsigned + IsLess<N>,
Le<Index, N>: IsTrue,
N: Sub<B1>,
Sub1<N>: Unsigned,
[src]
pub fn remove<Index>(self, _: Index) -> (Vec<Sub1<N>, A>, A) where
Index: Unsigned + IsLess<N>,
Le<Index, N>: IsTrue,
N: Sub<B1>,
Sub1<N>: Unsigned,
Remove the element at index Index
from the vector.
pub fn swap_remove<Index>(self, _: Index) -> (Vec<Sub1<N>, A>, A) where
Index: Unsigned + IsLess<N>,
Le<Index, N>: IsTrue,
N: Sub<B1>,
Sub1<N>: Unsigned,
[src]
pub fn swap_remove<Index>(self, _: Index) -> (Vec<Sub1<N>, A>, A) where
Index: Unsigned + IsLess<N>,
Le<Index, N>: IsTrue,
N: Sub<B1>,
Sub1<N>: Unsigned,
Remove the element at index Index
from the vector,
replacing it with the element at the end of the vector.
pub fn append<M>(self, other: Vec<M, A>) -> Vec<Sum<N, M>, A> where
N: Add<M>,
M: Unsigned,
Sum<N, M>: Unsigned,
[src]
pub fn append<M>(self, other: Vec<M, A>) -> Vec<Sum<N, M>, A> where
N: Add<M>,
M: Unsigned,
Sum<N, M>: Unsigned,
Append two vectors together.
pub fn get<Index>(&self, _: Index) -> &A where
Index: Unsigned + IsLess<N>,
Le<Index, N>: IsTrue,
[src]
pub fn get<Index>(&self, _: Index) -> &A where
Index: Unsigned + IsLess<N>,
Le<Index, N>: IsTrue,
Get a reference to the element at index Index
.
pub fn get_mut<Index>(&mut self, _: Index) -> &mut A where
Index: Unsigned + IsLess<N>,
Le<Index, N>: IsTrue,
[src]
pub fn get_mut<Index>(&mut self, _: Index) -> &mut A where
Index: Unsigned + IsLess<N>,
Le<Index, N>: IsTrue,
Get a mutable reference to the element at index Index
.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Get the length of the vector.
pub fn is_empty(&self) -> bool where
N: IsEqual<U0>,
[src]
pub fn is_empty(&self) -> bool where
N: IsEqual<U0>,
Test if the vector is empty.
pub fn iter(&self) -> Iter<A>
[src]
pub fn iter(&self) -> Iter<A>
Get an iterator over the elements of the vector.
pub fn iter_mut(&mut self) -> IterMut<A>
[src]
pub fn iter_mut(&mut self) -> IterMut<A>
Get a mutable iterator over the elements of the vector.
pub fn as_slice(&self) -> &[A]
[src]
pub fn as_slice(&self) -> &[A]
Get a reference to the slice of elements contained in the vector.
pub fn as_mut_slice(&mut self) -> &mut [A]
[src]
pub fn as_mut_slice(&mut self) -> &mut [A]
Get a mutable reference to the slice of elements contained in the vector.
pub fn truncate<M>(self) -> Vec<M, A> where
M: Unsigned + IsLessOrEqual<N>,
LeEq<M, N>: IsTrue,
[src]
pub fn truncate<M>(self) -> Vec<M, A> where
M: Unsigned + IsLessOrEqual<N>,
LeEq<M, N>: IsTrue,
Truncate the vector to fit the size given by the target type.
Examples
let vec_6 = svec![1, 2, 3, 4, 5, 6]; let vec_3: Vec<U3, _> = vec_6.truncate(); assert_eq!(svec![1, 2, 3], vec_3);
pub fn slice<Left, Right>(
self,
_: Range<Left, Right>
) -> (Vec<Diff<N, Diff<Right, Left>>, A>, Vec<Diff<Right, Left>, A>) where
Diff<N, Diff<Right, Left>>: Unsigned,
Diff<Right, Left>: Unsigned,
Left: Unsigned + IsLessOrEqual<Right>,
Right: Unsigned + Sub<Left> + IsLessOrEqual<N>,
N: Sub<Diff<Right, Left>>,
LeEq<Left, Right>: IsTrue,
LeEq<Right, N>: IsTrue,
[src]
pub fn slice<Left, Right>(
self,
_: Range<Left, Right>
) -> (Vec<Diff<N, Diff<Right, Left>>, A>, Vec<Diff<Right, Left>, A>) where
Diff<N, Diff<Right, Left>>: Unsigned,
Diff<Right, Left>: Unsigned,
Left: Unsigned + IsLessOrEqual<Right>,
Right: Unsigned + Sub<Left> + IsLessOrEqual<N>,
N: Sub<Diff<Right, Left>>,
LeEq<Left, Right>: IsTrue,
LeEq<Right, N>: IsTrue,
Slice a subset out of the vector.
Examples
let vec = svec![1, 2, 3, 4, 5, 6]; let (vec, sub_vec) = vec.slice(Range::<U2, U4>::new()); assert_eq!(svec![1, 2, 5, 6], vec); assert_eq!(svec![3, 4], sub_vec);
pub fn drain<Left, Right>(
self,
range: Range<Left, Right>
) -> (Vec<Diff<N, Diff<Right, Left>>, A>, impl Iterator<Item = A>) where
Diff<N, Diff<Right, Left>>: Unsigned,
Diff<Right, Left>: Unsigned,
Left: Unsigned + IsLessOrEqual<Right>,
Right: Unsigned + Sub<Left> + IsLessOrEqual<N>,
N: Sub<Diff<Right, Left>>,
LeEq<Left, Right>: IsTrue,
LeEq<Right, N>: IsTrue,
[src]
pub fn drain<Left, Right>(
self,
range: Range<Left, Right>
) -> (Vec<Diff<N, Diff<Right, Left>>, A>, impl Iterator<Item = A>) where
Diff<N, Diff<Right, Left>>: Unsigned,
Diff<Right, Left>: Unsigned,
Left: Unsigned + IsLessOrEqual<Right>,
Right: Unsigned + Sub<Left> + IsLessOrEqual<N>,
N: Sub<Diff<Right, Left>>,
LeEq<Left, Right>: IsTrue,
LeEq<Right, N>: IsTrue,
Remove a subset from the vector and return an iterator over the removed elements.
Examples
let vec = svec![1, 2, 3, 4, 5, 6]; let (vec, iter) = vec.drain(Range::<U2, U4>::new()); assert_eq!(svec![1, 2, 5, 6], vec); assert_eq!(vec![3, 4], iter.collect::<::std::vec::Vec<_>>());
pub fn clear(self) -> Vec<U0, A>
[src]
pub fn clear(self) -> Vec<U0, A>
Drop the contents of the vector, leaving an empty vector.
pub fn split_off<Index>(
self,
_: Index
) -> (Vec<Index, A>, Vec<Diff<N, Index>, A>) where
Index: Unsigned + IsLessOrEqual<N>,
N: Sub<Index>,
Diff<N, Index>: Unsigned,
LeEq<Index, N>: IsTrue,
[src]
pub fn split_off<Index>(
self,
_: Index
) -> (Vec<Index, A>, Vec<Diff<N, Index>, A>) where
Index: Unsigned + IsLessOrEqual<N>,
N: Sub<Index>,
Diff<N, Index>: Unsigned,
LeEq<Index, N>: IsTrue,
Split the vector at Index
, returning the two sides of the split.
Examples
let vec = svec![1, 2, 3, 4, 5, 6]; let (left, right) = vec.split_off(U3::new()); assert_eq!(svec![1, 2, 3], left); assert_eq!(svec![4, 5, 6], right);
pub fn resize<M>(self, value: A) -> Vec<M, A> where
M: Unsigned,
A: Clone,
[src]
pub fn resize<M>(self, value: A) -> Vec<M, A> where
M: Unsigned,
A: Clone,
Resize the vector, dropping elements if the new size is smaller,
and padding with copies of value
if it is larger.
Examples
let vec = svec![1, 2, 3]; let vec: Vec<U5, _> = vec.resize(100); assert_eq!(svec![1, 2, 3, 100, 100], vec);
pub fn map<F, B>(self, f: F) -> Vec<N, B> where
F: FnMut(A) -> B,
[src]
pub fn map<F, B>(self, f: F) -> Vec<N, B> where
F: FnMut(A) -> B,
Map the vector into a vector of elements of B
using a function.
Examples
let vec = svec![1, 2, 3]; let vec = vec.map(|num| format!("{}", num)); assert_eq!(svec![ "1".to_string(), "2".to_string(), "3".to_string() ], vec);
pub fn zip<B, C, F>(self, other: Vec<N, B>, f: F) -> Vec<N, C> where
F: FnMut(A, B) -> C,
[src]
pub fn zip<B, C, F>(self, other: Vec<N, B>, f: F) -> Vec<N, C> where
F: FnMut(A, B) -> C,
Merge two vectors together into a new vector using a function.
Examples
let left = svec!["foo", "bar"]; let right = svec!["lol", "omg"]; let vec = left.zip(right, |a, b| format!("{} {}", a, b)); assert_eq!(svec![ "foo lol".to_string(), "bar omg".to_string() ], vec);
pub fn unzip<B, C, F>(self, f: F) -> (Vec<N, B>, Vec<N, C>) where
F: FnMut(A) -> (B, C),
[src]
pub fn unzip<B, C, F>(self, f: F) -> (Vec<N, B>, Vec<N, C>) where
F: FnMut(A) -> (B, C),
Split a vector into two vectors of the same size using a function.
Examples
let left = svec!["foo", "bar"]; let right = svec!["lol", "omg"]; let vec = left.zip(right, |a, b| format!("{} {}", a, b)); assert_eq!(svec![ "foo lol".to_string(), "bar omg".to_string() ], vec);
Trait Implementations
impl<N: PartialEq, A: PartialEq> PartialEq for Vec<N, A> where
N: Unsigned,
[src]
impl<N: PartialEq, A: PartialEq> PartialEq for Vec<N, A> where
N: Unsigned,
fn eq(&self, other: &Vec<N, A>) -> bool
[src]
fn eq(&self, other: &Vec<N, A>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Vec<N, A>) -> bool
[src]
fn ne(&self, other: &Vec<N, A>) -> bool
This method tests for !=
.
impl<N: Eq, A: Eq> Eq for Vec<N, A> where
N: Unsigned,
[src]
impl<N: Eq, A: Eq> Eq for Vec<N, A> where
N: Unsigned,
impl<N: Clone, A: Clone> Clone for Vec<N, A> where
N: Unsigned,
[src]
impl<N: Clone, A: Clone> Clone for Vec<N, A> where
N: Unsigned,
fn clone(&self) -> Vec<N, A>
[src]
fn clone(&self) -> Vec<N, A>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<N: Hash, A: Hash> Hash for Vec<N, A> where
N: Unsigned,
[src]
impl<N: Hash, A: Hash> Hash for Vec<N, A> where
N: Unsigned,
fn hash<__HNA: Hasher>(&self, state: &mut __HNA)
[src]
fn hash<__HNA: Hasher>(&self, state: &mut __HNA)
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]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<N: PartialOrd, A: PartialOrd> PartialOrd for Vec<N, A> where
N: Unsigned,
[src]
impl<N: PartialOrd, A: PartialOrd> PartialOrd for Vec<N, A> where
N: Unsigned,
fn partial_cmp(&self, other: &Vec<N, A>) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Vec<N, A>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Vec<N, A>) -> bool
[src]
fn lt(&self, other: &Vec<N, A>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Vec<N, A>) -> bool
[src]
fn le(&self, other: &Vec<N, A>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Vec<N, A>) -> bool
[src]
fn gt(&self, other: &Vec<N, A>) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Vec<N, A>) -> bool
[src]
fn ge(&self, other: &Vec<N, A>) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<N: Ord, A: Ord> Ord for Vec<N, A> where
N: Unsigned,
[src]
impl<N: Ord, A: Ord> Ord for Vec<N, A> where
N: Unsigned,
fn cmp(&self, other: &Vec<N, A>) -> Ordering
[src]
fn cmp(&self, other: &Vec<N, A>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl<A> Default for Vec<U0, A>
[src]
impl<A> Default for Vec<U0, A>
impl<N, A> Debug for Vec<N, A> where
N: Unsigned,
A: Debug,
[src]
impl<N, A> Debug for Vec<N, A> where
N: Unsigned,
A: Debug,
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl<N, M, A> Add<Vec<M, A>> for Vec<N, A> where
N: Unsigned + Add<M>,
M: Unsigned,
Sum<N, M>: Unsigned,
[src]
impl<N, M, A> Add<Vec<M, A>> for Vec<N, A> where
N: Unsigned + Add<M>,
M: Unsigned,
Sum<N, M>: Unsigned,
type Output = Vec<Sum<N, M>, A>
The resulting type after applying the +
operator.
fn add(self, other: Vec<M, A>) -> Self::Output
[src]
fn add(self, other: Vec<M, A>) -> Self::Output
Performs the +
operation.
impl<N, A> IntoIterator for Vec<N, A> where
N: Unsigned,
[src]
impl<N, A> IntoIterator for Vec<N, A> where
N: Unsigned,
type Item = A
The type of the elements being iterated over.
type IntoIter = IntoIter<A>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl<'a, N, A> IntoIterator for &'a Vec<N, A> where
N: Unsigned,
[src]
impl<'a, N, A> IntoIterator for &'a Vec<N, A> where
N: Unsigned,
type Item = &'a A
The type of the elements being iterated over.
type IntoIter = Iter<'a, A>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl<'a, N, A> IntoIterator for &'a mut Vec<N, A> where
N: Unsigned,
[src]
impl<'a, N, A> IntoIterator for &'a mut Vec<N, A> where
N: Unsigned,
type Item = &'a mut A
The type of the elements being iterated over.
type IntoIter = IterMut<'a, A>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl<N, A> Borrow<[A]> for Vec<N, A> where
N: Unsigned,
[src]
impl<N, A> Borrow<[A]> for Vec<N, A> where
N: Unsigned,
impl<N, A> BorrowMut<[A]> for Vec<N, A> where
N: Unsigned,
[src]
impl<N, A> BorrowMut<[A]> for Vec<N, A> where
N: Unsigned,
fn borrow_mut(&mut self) -> &mut [A]
[src]
fn borrow_mut(&mut self) -> &mut [A]
Mutably borrows from an owned value. Read more
impl<N, A, I> Index<I> for Vec<N, A> where
N: Unsigned,
I: Unsigned + IsLess<N>,
Le<I, N>: IsTrue,
[src]
impl<N, A, I> Index<I> for Vec<N, A> where
N: Unsigned,
I: Unsigned + IsLess<N>,
Le<I, N>: IsTrue,
type Output = A
The returned type after indexing.
fn index(&self, index: I) -> &Self::Output
[src]
fn index(&self, index: I) -> &Self::Output
Performs the indexing (container[index]
) operation.
impl<N, A, I> IndexMut<I> for Vec<N, A> where
N: Unsigned,
I: Unsigned + IsLess<N>,
Le<I, N>: IsTrue,
[src]
impl<N, A, I> IndexMut<I> for Vec<N, A> where
N: Unsigned,
I: Unsigned + IsLess<N>,
Le<I, N>: IsTrue,
fn index_mut(&mut self, index: I) -> &mut Self::Output
[src]
fn index_mut(&mut self, index: I) -> &mut Self::Output
Performs the mutable indexing (container[index]
) operation.
impl<N, A> AsRef<[A]> for Vec<N, A> where
N: Unsigned,
[src]
impl<N, A> AsRef<[A]> for Vec<N, A> where
N: Unsigned,
impl<N, A> AsRef<Vec<N, A>> for Vec<N, A> where
N: Unsigned,
[src]
impl<N, A> AsRef<Vec<N, A>> for Vec<N, A> where
N: Unsigned,
impl<N, A> AsMut<[A]> for Vec<N, A> where
N: Unsigned,
[src]
impl<N, A> AsMut<[A]> for Vec<N, A> where
N: Unsigned,
impl<N, A> AsMut<Vec<N, A>> for Vec<N, A> where
N: Unsigned,
[src]
impl<N, A> AsMut<Vec<N, A>> for Vec<N, A> where
N: Unsigned,