Struct Drain

struct Drain<'a> { ... }

A draining iterator for String.

This struct is created by the drain method on String. See its documentation for more.

Implementations

impl<'a> Drain<'a>

fn as_str(self: &Self) -> &str

Returns the remaining (sub)string of this iterator as a slice.

Examples

let mut s = String::from("abc");
let mut drain = s.drain(..);
assert_eq!(drain.as_str(), "abc");
let _ = drain.next().unwrap();
assert_eq!(drain.as_str(), "bc");

impl Debug for Drain<'_>

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

impl DoubleEndedIterator for Drain<'_>

fn next_back(self: &mut Self) -> Option<char>

impl Drop for Drain<'_>

fn drop(self: &mut Self)

impl FusedIterator for Drain<'_>

impl Iterator for Drain<'_>

fn next(self: &mut Self) -> Option<char>
fn size_hint(self: &Self) -> (usize, Option<usize>)
fn last(self: Self) -> Option<char>

impl Send for Drain<'_>

impl Sync for Drain<'_>

impl<'a> AsRef for Drain<'a>

fn as_ref(self: &Self) -> &str

impl<'a> AsRef for Drain<'a>

fn as_ref(self: &Self) -> &[u8]

impl<'a> Freeze for Drain<'a>

impl<'a> RefUnwindSafe for Drain<'a>

impl<'a> Unpin for Drain<'a>

impl<'a> UnwindSafe for Drain<'a>

impl<I> IntoIterator for Drain<'a>

fn into_iter(self: Self) -> I

impl<T> Any for Drain<'a>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Drain<'a>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Drain<'a>

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

impl<T> From for Drain<'a>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Drain<'a>

fn into(self: 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 for Drain<'a>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Drain<'a>

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