Struct Drain
pub struct Drain<'a> { pub(in ::string) string: *mut String, pub(in ::string) start: usize, pub(in ::string) end: usize, pub(in ::string) iter: Chars<'a> }
A draining iterator for String.
This struct is created by the drain method on String. See its
documentation for more.
Fields
string: *mut StringWill be used as &'a mut String in the destructor
start: usizeStart of part to remove
end: usizeEnd of part to remove
iter: Chars<'a>Current remaining range to remove
Implementations
impl<'a> Drain<'a>
fn as_str(&self) -> &strReturns the remaining (sub)string of this iterator as a slice.
Examples
let mut s = Stringfrom; let mut drain = s.drain; assert_eq!; let _ = drain.next.unwrap; assert_eq!;
Trait Implementations
impl Debug for Drain<'_>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl DoubleEndedIterator for Drain<'_>
fn next_back(&mut self) -> Option<char>
impl Drop for Drain<'_>
fn drop(&mut self)
impl FusedIterator for Drain<'_>
impl Iterator for Drain<'_>
type Item = char;fn next(&mut self) -> Option<char>fn size_hint(&self) -> (usize, Option<usize>)fn last(self) -> Option<char>
impl Send for Drain<'_>
impl Sync for Drain<'_>
impl<'a> AsRef<[u8]> for Drain<'a>
fn as_ref(&self) -> &[u8]
impl<'a> AsRef<str> for Drain<'a>
fn as_ref(&self) -> &str
Auto Trait Implementations
impl<'a> Freeze for Drain<'a>
impl<'a> RefUnwindSafe for Drain<'a>
impl<'a> Unpin for Drain<'a>
impl<'a> UnsafeUnpin for Drain<'a>
impl<'a> UnwindSafe for Drain<'a>
Blanket Implementations
impl<I> IntoIterator for Drain<'a>
where
I: Iterator,
type Item = <I as Iterator>::Item;type IntoIter = I;fn into_iter(self) -> I
impl<T> Any for Drain<'a>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Drain<'a>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Drain<'a>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Drain<'a>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for Drain<'a>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Drain<'a>
impl<T, U> Into<U> for Drain<'a>
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 Drain<'a>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Drain<'a>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>