[][src]Struct bitvec::vec::IntoIter

#[repr(C)]pub struct IntoIter<O, T> where
    O: BitOrder,
    T: BitStore
{ /* fields omitted */ }

A consuming iterator for BitVec.

Trait Implementations

impl<O, T> DoubleEndedIterator for IntoIter<O, T> where
    O: BitOrder,
    T: BitStore
[src]

impl<O, T> ExactSizeIterator for IntoIter<O, T> where
    O: BitOrder,
    T: BitStore
[src]

impl<O, T> FusedIterator for IntoIter<O, T> where
    O: BitOrder,
    T: BitStore
[src]

impl<O, T> Iterator for IntoIter<O, T> where
    O: BitOrder,
    T: BitStore
[src]

type Item = bool

The type of the elements being iterated over.

fn next(&mut self) -> Option<Self::Item>[src]

Advances the iterator by one, returning the first bit in it (if any).

Parameters

  • &mut self

Returns

The leading bit in the iterator, if any.

Examples

use bitvec::prelude::*;

let bv = bitvec![1, 0];
let mut iter = bv.iter();
assert!(iter.next().unwrap());
assert!(!iter.next().unwrap());
assert!(iter.next().is_none());

fn size_hint(&self) -> (usize, Option<usize>)[src]

Hints at the number of bits remaining in the iterator.

Because the exact size is always known, this always produces (len, Some(len)).

Parameters

  • &self

Returns

  • usize: The minimum bits remaining.
  • Option<usize>: The maximum bits remaining.

Examples

use bitvec::prelude::*;

let bv = bitvec![0, 1];
let mut iter = bv.iter();
assert_eq!(iter.size_hint(), (2, Some(2)));
iter.next();
assert_eq!(iter.size_hint(), (1, Some(1)));
iter.next();
assert_eq!(iter.size_hint(), (0, Some(0)));

fn count(self) -> usize[src]

Counts how many bits are live in the iterator, consuming it.

You are probably looking to use this on a borrowed iterator rather than an owning iterator. See BitSlice.

Parameters

  • self

Returns

The number of bits in the iterator.

Examples

use bitvec::prelude::*;
let bv = bitvec![Msb0, u8; 0, 1, 0, 1, 0];
assert_eq!(bv.into_iter().count(), 5);

fn nth(&mut self, n: usize) -> Option<Self::Item>[src]

Advances the iterator by n bits, starting from zero.

Parameters

  • &mut self
  • n: The number of bits to skip, before producing the next bit after skips. If this overshoots the iterator’s remaining length, then the iterator is marked empty before returning None.

Returns

If n does not overshoot the iterator’s bounds, this produces the nth bit after advancing the iterator to it, discarding the intermediate bits.

If n does overshoot the iterator’s bounds, this empties the iterator and returns None.

Examples

use bitvec::prelude::*;
let bv = bitvec![Msb0, u8; 0, 0, 0, 1];
let mut iter = bv.into_iter();
assert_eq!(iter.len(), 4);
assert!(iter.nth(3).unwrap());
assert!(iter.nth(0).is_none());

fn last(self) -> Option<Self::Item>[src]

Consumes the iterator, returning only the last bit.

Examples

use bitvec::prelude::*;
let bv = bitvec![Msb0, u8; 0, 0, 0, 1];
assert!(bv.into_iter().last().unwrap());

Empty iterators return None

use bitvec::prelude::*;
assert!(bitvec![].into_iter().last().is_none());

Auto Trait Implementations

impl<O, T> RefUnwindSafe for IntoIter<O, T> where
    O: RefUnwindSafe,
    T: RefUnwindSafe

impl<O, T> !Send for IntoIter<O, T>

impl<O, T> !Sync for IntoIter<O, T>

impl<O, T> Unpin for IntoIter<O, T> where
    O: Unpin,
    T: Unpin

impl<O, T> UnwindSafe for IntoIter<O, T> where
    O: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.