Struct heapless::Vec
[−]
[src]
pub struct Vec<T, A> where
A: Unsize<[T]>, { /* fields omitted */ }
A Vec
, vector, backed by a fixed size array
Methods
impl<T, A> Vec<T, A> where
A: Unsize<[T]>,
[src]
A: Unsize<[T]>,
const fn new() -> Self
[src]
Constructs a new, empty Vec<T>
backed by the array A
fn capacity(&self) -> usize
[src]
Returns the maximum number of elements the vector can hold
fn clear(&mut self)
[src]
Clears the vector, removing all values.
fn pop(&mut self) -> Option<T>
[src]
Removes the last element from a vector and return it, or None
if it's empty
fn push(&mut self, item: T) -> Result<(), BufferFullError>
[src]
Appends an element to the back of the collection
Returns BufferFullError
if the vector is full
fn truncate(&mut self, len: usize)
[src]
Shortens the vector, keeping the first len
elements and dropping the rest.
fn resize(&mut self, new_len: usize, value: T) -> Result<(), BufferFullError> where
T: Clone,
[src]
T: Clone,
Resizes the Vec in-place so that len is equal to new_len.
If new_len is greater than len, the Vec is extended by the difference, with each additional slot filled with value. If new_len is less than len, the Vec is simply truncated.
See also [resize_default
].
fn resize_default(&mut self, new_len: usize) -> Result<(), BufferFullError> where
T: Clone + Default,
[src]
T: Clone + Default,
Resizes the Vec
in-place so that len
is equal to new_len
.
If new_len
is greater than len
, the Vec
is extended by the
difference, with each additional slot filled with Default::default()
.
If new_len
is less than len
, the Vec
is simply truncated.
See also [resize
].
Trait Implementations
impl<T, A> Debug for Vec<T, A> where
A: Unsize<[T]>,
T: Debug,
[src]
A: Unsize<[T]>,
T: Debug,
impl<T, A> Drop for Vec<T, A> where
A: Unsize<[T]>,
[src]
A: Unsize<[T]>,
impl<'a, T, A> IntoIterator for &'a Vec<T, A> where
A: Unsize<[T]>,
[src]
A: Unsize<[T]>,
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) -> Self::IntoIter
[src]
Creates an iterator from a value. Read more
impl<'a, T, A> IntoIterator for &'a mut Vec<T, A> where
A: Unsize<[T]>,
[src]
A: Unsize<[T]>,
type Item = &'a mut T
The type of the elements being iterated over.
type IntoIter = IterMut<'a, T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
Creates an iterator from a value. Read more
impl<T, A, B> PartialEq<Vec<T, B>> for Vec<T, A> where
A: Unsize<[T]>,
B: Unsize<[T]>,
T: PartialEq,
[src]
A: Unsize<[T]>,
B: Unsize<[T]>,
T: PartialEq,
fn eq(&self, rhs: &Vec<T, B>) -> 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, A> Eq for Vec<T, A> where
A: Unsize<[T]>,
T: Eq,
[src]
A: Unsize<[T]>,
T: Eq,
impl<T, A> Deref for Vec<T, A> where
A: Unsize<[T]>,
[src]
A: Unsize<[T]>,
type Target = [T]
The resulting type after dereferencing.
fn deref(&self) -> &[T]
[src]
Dereferences the value.
impl<T, A> DerefMut for Vec<T, A> where
A: Unsize<[T]>,
[src]
A: Unsize<[T]>,