[−][src]Struct oom::NonEmptyVec
A non-empty vector type, counterpart of Vec<T>
.
Implementations
impl<T: Sized> NonEmptyVec<T>
[src]
pub fn from_vec(vec: Vec<T>) -> Self
[src]
pub fn from_vec_checked(vec: Vec<T>) -> Result<Self, Vec<T>>
[src]
Converts a Vec<T>
into a NonEmptyVec
.
Returns passed Vec
if it is empty.
pub fn as_ptr(&self) -> *const T
[src]
Returns a raw pointer to the vector's buffer.
pub fn as_mut_ptr(&mut self) -> *mut T
[src]
Returns an unsafe mutable pointer to the vector's buffer.
pub fn as_nonempty_slice(&self) -> NonEmptySlice<'_, T>
[src]
Returns a non-empty slice from this vec.
pub fn as_nonempty_mut_slice(&mut self) -> NonEmptyMutSlice<'_, T>
[src]
Returns a non-empty mutable slice from this vec.
pub fn as_slice(&self) -> &[T]
[src]
Extracts a slice containing the entire vector.
pub fn as_mut_slice(&mut self) -> &mut [T]
[src]
Extracts a mutable slice of the entire vector.
pub fn len(&self) -> NonZeroUsize
[src]
Returns the number of elements in the vector.
pub fn is_empty(&self) -> bool
[src]
Always returns false
because the vector is non-empty.
pub fn capacity(&self) -> NonZeroUsize
[src]
Returns the number of elements the vector can hold without reallocating.
pub fn into_vec(self) -> Vec<T>
[src]
Converts self
into a vector without clones or allocations.
pub fn to_vec(&self) -> Vec<T> where
T: Clone,
[src]
T: Clone,
Copies self
into a new Vec
.
pub fn first(&self) -> &T
[src]
A shorthand for NonEmptyMutSlice::first
.
pub fn first_mut(&mut self) -> &mut T
[src]
A shorthand for NonEmptyMutSlice::first_mut
.
pub fn last(&self) -> &T
[src]
A shorthand for NonEmptyMutSlice::last
.
pub fn last_mut(&mut self) -> &mut T
[src]
A shorthand for NonEmptyMutSlice::last_mut
.
pub fn split_first(&self) -> (&T, &[T])
[src]
A shorthand for NonEmptyMutSlice::split_first
.
pub fn split_first_mut(&mut self) -> (&mut T, &mut [T])
[src]
A shorthand for NonEmptyMutSlice::split_first_mut
.
pub fn split_last(&self) -> (&T, &[T])
[src]
A shorthand for NonEmptyMutSlice::split_last
.
pub fn split_last_mut(&mut self) -> (&mut T, &mut [T])
[src]
A shorthand for NonEmptyMutSlice::split_last_mut
.
Trait Implementations
impl<T> AsRef<[T]> for NonEmptyVec<T>
[src]
impl<T: Clone> Clone for NonEmptyVec<T>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Eq> Eq for NonEmptyVec<T>
[src]
impl<T: Ord> Ord for NonEmptyVec<T>
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T: PartialEq> PartialEq<NonEmptyVec<T>> for NonEmptyVec<T>
[src]
impl<T: PartialOrd> PartialOrd<NonEmptyVec<T>> for NonEmptyVec<T>
[src]
Auto Trait Implementations
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,
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<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>,