Struct SplitInclusive

pub struct SplitInclusive<'a, P: Pattern>(pub(in ::str) SplitInternal<'a, P>);

An iterator over the substrings of a string, terminated by a substring matching to 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 str. See its documentation for more.

Fields

0: SplitInternal<'a, P>

Implementations

impl<'a, P: Pattern> SplitInclusive<'a, P>

fn remainder(&self) -> Option<&'a str>

Returns remainder of the split string.

If the iterator is empty, returns None.

Examples

#![feature(str_split_inclusive_remainder)]
let mut split = "Mary had a little lamb".split_inclusive(' ');
assert_eq!(split.remainder(), Some("Mary had a little lamb"));
split.next();
assert_eq!(split.remainder(), Some("had a little lamb"));
split.by_ref().for_each(drop);
assert_eq!(split.remainder(), None);

Trait Implementations

impl<'a, P: Pattern> FusedIterator for SplitInclusive<'a, P>

impl<'a, P: Pattern> Iterator for SplitInclusive<'a, P>

type Item = &'a str;
fn next(&mut self) -> Option<&'a str>

impl<'a, P: Pattern<Searcher<'a>: Clone>> Clone for SplitInclusive<'a, P>

fn clone(&self) -> Self

impl<'a, P: Pattern<Searcher<'a>: Debug>> Debug for SplitInclusive<'a, P>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<'a, P: Pattern<Searcher<'a>: DoubleEndedSearcher<'a>>> DoubleEndedIterator for SplitInclusive<'a, P>

fn next_back(&mut self) -> Option<&'a str>

Auto Trait Implementations

impl<'a, P> Freeze for SplitInclusive<'a, P> where SplitInternal<'a, P>: Freeze,

impl<'a, P> RefUnwindSafe for SplitInclusive<'a, P> where SplitInternal<'a, P>: RefUnwindSafe,

impl<'a, P> Send for SplitInclusive<'a, P> where SplitInternal<'a, P>: Send,

impl<'a, P> Sync for SplitInclusive<'a, P> where SplitInternal<'a, P>: Sync,

impl<'a, P> Unpin for SplitInclusive<'a, P> where SplitInternal<'a, P>: Unpin,

impl<'a, P> UnsafeUnpin for SplitInclusive<'a, P> where SplitInternal<'a, P>: UnsafeUnpin,

impl<'a, P> UnwindSafe for SplitInclusive<'a, P> where SplitInternal<'a, P>: UnwindSafe,

Blanket Implementations

impl<I> IntoIterator for SplitInclusive<'a, P> where I: Iterator,

type Item = <I as Iterator>::Item;
type IntoIter = I;
fn into_iter(self) -> I

impl<T> Any for SplitInclusive<'a, P> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for SplitInclusive<'a, P> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for SplitInclusive<'a, P> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for SplitInclusive<'a, P> where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for SplitInclusive<'a, P>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for SplitInclusive<'a, P> where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for SplitInclusive<'a, P>

impl<T, U> Into<U> for SplitInclusive<'a, P> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for SplitInclusive<'a, 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, P> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>