[][src]Struct strict::NonEmptyVec

pub struct NonEmptyVec<T> { /* fields omitted */ }

a mostly costless wrapping of a vec, ensuring there's always at least one element.

Follow the semantics of Vec (differing methods have a different name).

Implementations

impl<T> NonEmptyVec<T>[src]

pub fn len(&self) -> NonZeroUsize[src]

pub fn has_len(&self, len: usize) -> bool[src]

pub fn first(&self) -> &T[src]

pub fn first_mut(&mut self) -> &mut T[src]

pub fn last(&self) -> &T[src]

pub fn last_mut(&mut self) -> &mut T[src]

pub fn take(self) -> T[src]

take the first item, discard the rest

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

pub fn insert(&mut self, insertion_idx: usize, value: T)[src]

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

Removes the last element from a vector and returns it, or None if it contains only one element

pub fn as_slice(&self) -> &[T][src]

pub fn as_mut_slice(&mut self) -> &mut [T][src]

pub fn remove(&mut self, idx: usize) -> Result<T, NotEnoughElementsError>[src]

pub fn swap_remove(&mut self, idx: usize) -> Result<T, NotEnoughElementsError>[src]

Trait Implementations

impl<T: Clone> Clone for NonEmptyVec<T>[src]

impl<T: Debug> Debug for NonEmptyVec<T>[src]

impl<T> Deref for NonEmptyVec<T>[src]

type Target = [T]

The resulting type after dereferencing.

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

impl<T, I: SliceIndex<[T]>> Index<I> for NonEmptyVec<T>[src]

type Output = I::Output

The returned type after indexing.

impl<T, I: SliceIndex<[T]>> IndexMut<I> for NonEmptyVec<T>[src]

impl<'a, T> IntoIterator for &'a mut NonEmptyVec<T>[src]

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?

impl<'a, T> IntoIterator for &'a NonEmptyVec<T>[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?

impl<T> TryFrom<Vec<T>> for NonEmptyVec<T>[src]

type Error = NotEnoughElementsError

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<T> RefUnwindSafe for NonEmptyVec<T> where
    T: RefUnwindSafe

impl<T> Send for NonEmptyVec<T> where
    T: Send

impl<T> Sync for NonEmptyVec<T> where
    T: Sync

impl<T> Unpin for NonEmptyVec<T> where
    T: Unpin

impl<T> UnwindSafe for NonEmptyVec<T> where
    T: UnwindSafe

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<!> for T[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.