Struct DrainBytes

pub struct DrainBytes<'a> { /* private fields */ }

A draining byte oriented iterator for Vec<u8>.

This iterator is created by ByteVec::drain_bytes.

Examples

Basic usage:

use bstr::ByteVec;

let mut s = Vec::from("foobar");
{
    let mut drainer = s.drain_bytes(2..4);
    assert_eq!(drainer.next(), Some(b'o'));
    assert_eq!(drainer.next(), Some(b'b'));
    assert_eq!(drainer.next(), None);
}
assert_eq!(s, "foar".as_bytes());

Trait Implementations

impl<'a> Debug for DrainBytes<'a>

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

impl<'a> DoubleEndedIterator for DrainBytes<'a>

fn next_back(&mut self) -> Option<u8>

impl<'a> ExactSizeIterator for DrainBytes<'a>

fn len(&self) -> usize

impl<'a> FusedIterator for DrainBytes<'a>

impl<'a> Iterator for DrainBytes<'a>

type Item = u8;
fn next(&mut self) -> Option<u8>

Auto Trait Implementations

impl<'a> Freeze for DrainBytes<'a>

impl<'a> RefUnwindSafe for DrainBytes<'a>

impl<'a> Send for DrainBytes<'a>

impl<'a> Sync for DrainBytes<'a>

impl<'a> Unpin for DrainBytes<'a>

impl<'a> UnsafeUnpin for DrainBytes<'a>

impl<'a> UnwindSafe for DrainBytes<'a>

Blanket Implementations

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

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

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

fn from(t: T) -> T

Returns the argument unchanged.

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for DrainBytes<'a> where U: TryFrom<T>,

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