Trait flatk::SplitFirst [−][src]
pub trait SplitFirst where
Self: Sized, {
type First;
fn split_first(self) -> Option<(Self::First, Self)>;
unsafe fn split_first_unchecked(self) -> (Self::First, Self) { ... }
}
Expand description
Split out the first element of a collection.
Associated Types
Required methods
Provided methods
unsafe fn split_first_unchecked(self) -> (Self::First, Self)
unsafe fn split_first_unchecked(self) -> (Self::First, Self)
Split off the first element without checking if one exists.
Safety
The collection must have at least one element otherwise this function may cause undefined behaviour if implemented.
The default implementation simply calls unwrap on split_first
.
Implementations on Foreign Types
Implementors
impl<S, I> SplitFirst for Subset<S, I> where
I: SplitFirst + AsRef<[usize]>,
<I as SplitFirst>::First: Borrow<usize>,
S: Set + SplitAt + SplitFirst,
impl<S, I> SplitFirst for Subset<S, I> where
I: SplitFirst + AsRef<[usize]>,
<I as SplitFirst>::First: Borrow<usize>,
S: Set + SplitAt + SplitFirst,
This impl enables Subset
s of Subset
s