[][src]Struct storagevec::svec::StorageVec

#[repr(transparent)]pub struct StorageVec<T: Default, const N: usize>(_);

A list-like object that will either use the tinyvec ArrayVec, the standard library Vec, or the tinyvec TinyVec as a backing implementation. It will use the alloc and stack features to control this.

Implementations

impl<T: Default, const N: usize> StorageVec<T, N>[src]

#[must_use]pub fn new() -> Self[src]

Create a new StorageVec.

pub fn try_push(&mut self, item: T) -> Result<(), T>[src]

Try to push an item onto this list.

Errors

If the push operation fails due to capacity overflow, the element is returned back in an Err.

pub fn push(&mut self, item: T)[src]

Push an item onto this list, and panic if the push operation failed.

pub fn pop(&mut self) -> Option<T>[src]

Pop an item from the back of this list.

pub fn try_insert(&mut self, item: T, index: usize) -> Result<(), T>[src]

Try to insert an item into this list.

Errors

If the element cannot be inserted into the list due to capacity overflow, the element is returned back in an Err.

pub fn insert(&mut self, item: T, index: usize)[src]

Insert an item into this list, and panic if the insert operation fails.

pub fn remove(&mut self, index: usize) -> Option<T>[src]

Remove an item from this list.

pub fn drain<'a, R: RangeBounds<usize> + 'a>(
    &'a mut self,
    range: R
) -> impl Iterator<Item = T> + 'a where
    T: 'a, 
[src]

Create a drain iterator for this vector.

Trait Implementations

impl<T: Clone + Default, const N: usize> Clone for StorageVec<T, N>[src]

impl<T: Default + Debug, const N: usize> Debug for StorageVec<T, N>[src]

impl<T: Default, const N: usize> Default for StorageVec<T, N>[src]

impl<T: Default, const N: usize> Deref for StorageVec<T, N>[src]

type Target = [T]

The resulting type after dereferencing.

impl<T: Default, const N: usize> DerefMut for StorageVec<T, N>[src]

impl<T: Default, const N: usize> Extend<T> for StorageVec<T, N>[src]

impl<T: Default, const N: usize> FromIterator<T> for StorageVec<T, N>[src]

impl<T: Default, const N: usize> IntoIterator for StorageVec<T, N>[src]

type Item = T

The type of the elements being iterated over.

type IntoIter = StorageVecIterator<T, N>

Which kind of iterator are we turning this into?

Auto Trait Implementations

impl<T, const N: usize> Send for StorageVec<T, N> where
    T: Send
[src]

impl<T, const N: usize> Sync for StorageVec<T, N> where
    T: Sync
[src]

impl<T, const N: usize> Unpin for StorageVec<T, N> where
    T: Unpin
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.