[−][src]Struct strict::NonEmptyVec
a mostly costless wrapping of a vec, ensuring there's always at least one element
Methods
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
pub fn push(&mut self, 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 swap_remove(&mut self, idx: usize) -> Result<T, NotEnoughElementsError>
[src]
Trait Implementations
impl<T: Clone> Clone for NonEmptyVec<T>
[src]
fn clone(&self) -> NonEmptyVec<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug> Debug for NonEmptyVec<T>
[src]
impl<T> Deref for NonEmptyVec<T>
[src]
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.
fn index(&self, index: I) -> &Self::Output
[src]
impl<T, I: SliceIndex<[T]>> IndexMut<I> for NonEmptyVec<T>
[src]
impl<T> TryFrom<Vec<T>> for NonEmptyVec<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for NonEmptyVec<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for NonEmptyVec<T> where
T: Send,
T: Send,
impl<T> Sync for NonEmptyVec<T> where
T: Sync,
T: Sync,
impl<T> Unpin for NonEmptyVec<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for NonEmptyVec<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[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]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,