Struct vector_array::vec::VecArray
source · pub struct VecArray<T, const CAP: usize> { /* private fields */ }
Expand description
A Vec but entirely on the stack.
Example:
use vec_array::vec::VecArray;
let mut vec: VecArray<_, 10> = VecArray::new();
vec.push(9).unwrap();
assert_eq!(vec[0], 9);
Implementations§
source§impl<T, const CAP: usize> VecArray<T, CAP>
impl<T, const CAP: usize> VecArray<T, CAP>
sourcepub fn push(&mut self, value: T) -> Result<(), ArrTooSmall>
pub fn push(&mut self, value: T) -> Result<(), ArrTooSmall>
Pushes an element.
Example:
use vec_array::vec::VecArray;
let mut vec: VecArray<_, 10> = VecArray::new();
vec.push(9).unwrap();
assert_eq!(vec[0], 9);
pub fn get(&self, index: usize) -> Option<&T>
pub fn truncate(&mut self, len: usize)
pub fn as_mut_ptr(&mut self) -> *mut T
pub fn as_ptr(&self) -> *const T
pub fn get_arr(self) -> [T; CAP]
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn as_slice(&self) -> &[T]
pub fn as_mut_slice(&mut self) -> &mut [T]
pub fn clear(&mut self)
pub fn capacity(&self) -> usize
Trait Implementations§
source§impl<T, const CAP: usize> IntoIterator for VecArray<T, CAP>
impl<T, const CAP: usize> IntoIterator for VecArray<T, CAP>
Auto Trait Implementations§
impl<T, const CAP: usize> RefUnwindSafe for VecArray<T, CAP>where T: RefUnwindSafe,
impl<T, const CAP: usize> Send for VecArray<T, CAP>where T: Send,
impl<T, const CAP: usize> Sync for VecArray<T, CAP>where T: Sync,
impl<T, const CAP: usize> Unpin for VecArray<T, CAP>where T: Unpin,
impl<T, const CAP: usize> UnwindSafe for VecArray<T, CAP>where T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more