Struct SplitInclusive
#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct SplitInclusive<'a, T: 'a, P>
where
P: FnMut(&T) -> bool, { pub(in ::slice::iter) v: &'a [T], pub(in ::slice::iter) pred: P, pub(in ::slice::iter) finished: bool }
An iterator over subslices separated by elements that match a predicate
function. Unlike Split, it contains the matched part as a terminator
of the subslice.
This struct is created by the split_inclusive method on slices.
Example
let slice = ;
let mut iter = slice.split_inclusive;
assert_eq!;
assert_eq!;
assert_eq!;
Fields
v: &'a [T]pred: Pfinished: bool
Implementations
impl<'a, T: 'a, P: FnMut(&T) -> bool> SplitInclusive<'a, T, P>
fn new(slice: &'a [T], pred: P) -> Self
Trait Implementations
impl<'a, T, P> DoubleEndedIterator for SplitInclusive<'a, T, P>
where
P: FnMut(&T) -> bool,
fn next_back(&mut self) -> Option<&'a [T]>
impl<'a, T, P> Iterator for SplitInclusive<'a, T, P>
where
P: FnMut(&T) -> bool,
type Item = &'a [T];fn next(&mut self) -> Option<&'a [T]>fn size_hint(&self) -> (usize, Option<usize>)
impl<T, P> Clone for SplitInclusive<'_, T, P>
where
P: Clone + FnMut(&T) -> bool,
fn clone(&self) -> Self
impl<T, P> FusedIterator for SplitInclusive<'_, T, P>
where
P: FnMut(&T) -> bool,
impl<T: Debug, P> Debug for SplitInclusive<'_, T, P>
where
P: FnMut(&T) -> bool,
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl<'a, T, P> Freeze for SplitInclusive<'a, T, P>
where
&'a [T]: Freeze,
P: Freeze,
impl<'a, T, P> RefUnwindSafe for SplitInclusive<'a, T, P>
where
&'a [T]: RefUnwindSafe,
P: RefUnwindSafe,
impl<'a, T, P> Send for SplitInclusive<'a, T, P>
where
&'a [T]: Send,
P: Send,
impl<'a, T, P> Sync for SplitInclusive<'a, T, P>
where
&'a [T]: Sync,
P: Sync,
impl<'a, T, P> Unpin for SplitInclusive<'a, T, P>
where
&'a [T]: Unpin,
P: Unpin,
impl<'a, T, P> UnsafeUnpin for SplitInclusive<'a, T, P>
where
&'a [T]: UnsafeUnpin,
P: UnsafeUnpin,
impl<'a, T, P> UnwindSafe for SplitInclusive<'a, T, P>
where
&'a [T]: UnwindSafe,
P: UnwindSafe,
Blanket Implementations
impl<I> IntoIterator for SplitInclusive<'a, T, P>
where
I: Iterator,
type Item = <I as Iterator>::Item;type IntoIter = I;fn into_iter(self) -> I
impl<T> Any for SplitInclusive<'a, T, P>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for SplitInclusive<'a, T, P>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for SplitInclusive<'a, T, P>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for SplitInclusive<'a, T, P>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for SplitInclusive<'a, T, P>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for SplitInclusive<'a, T, P>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for SplitInclusive<'a, T, P>
impl<T, U> Into<U> for SplitInclusive<'a, T, P>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for SplitInclusive<'a, T, P>
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for SplitInclusive<'a, T, P>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>