pub(crate) struct NonEmpty<T: Container>(T::Element, T);Expand description
Small helper to ensure some container type is not empty.
Tuple Fields§
§0: T::Element§1: TImplementations§
Source§impl<A> NonEmpty<Vec<A>>
impl<A> NonEmpty<Vec<A>>
pub(crate) fn new<I>(fst: A, rest: I) -> Selfwhere
I: IntoIterator<Item = A>,
pub(crate) fn assert_non_empty_vec<I>(it: I) -> Selfwhere
I: IntoIterator<Item = A>,
pub(crate) fn last(&self) -> &A
pub(crate) fn get(&self, i: usize) -> Option<&A>
pub(crate) fn iter(&self) -> impl Iterator<Item = &A>
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for NonEmpty<T>
impl<T> RefUnwindSafe for NonEmpty<T>
impl<T> Send for NonEmpty<T>
impl<T> Sync for NonEmpty<T>
impl<T> Unpin for NonEmpty<T>
impl<T> UnsafeUnpin for NonEmpty<T>
impl<T> UnwindSafe for NonEmpty<T>
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