Struct SplitWhitespace

pub struct SplitWhitespace<'a> { pub(in ::str) inner: Filter<Split<'a, IsWhitespace>, IsNotEmpty> }

An iterator over the non-whitespace substrings of a string, separated by any amount of whitespace.

This struct is created by the split_whitespace method on str. See its documentation for more.

Fields

inner: Filter<Split<'a, IsWhitespace>, IsNotEmpty>

Implementations

impl<'a> SplitWhitespace<'a>

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

Returns remainder of the split string

Examples

#![feature(str_split_whitespace_remainder)]

let mut split = "Mary had a little lamb".split_whitespace();
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 FusedIterator for SplitWhitespace<'_>

impl<'a> Clone for SplitWhitespace<'a>

fn clone(&self) -> SplitWhitespace<'a>

impl<'a> Debug for SplitWhitespace<'a>

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

impl<'a> DoubleEndedIterator for SplitWhitespace<'a>

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

impl<'a> Iterator for SplitWhitespace<'a>

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

Auto Trait Implementations

impl<'a> Freeze for SplitWhitespace<'a>

impl<'a> RefUnwindSafe for SplitWhitespace<'a>

impl<'a> Send for SplitWhitespace<'a>

impl<'a> Sync for SplitWhitespace<'a>

impl<'a> Unpin for SplitWhitespace<'a>

impl<'a> UnsafeUnpin for SplitWhitespace<'a>

impl<'a> UnwindSafe for SplitWhitespace<'a>

Blanket Implementations

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

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

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

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

impl<T> From<T> for SplitWhitespace<'a>

fn from(t: T) -> T

Returns the argument unchanged.

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

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

impl<T> SizedTypeProperties for SplitWhitespace<'a>

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

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