[][src]Struct bitvec::slice::IterMut

pub struct IterMut<'a, C, T> where
    C: Cursor,
    T: 'a + BitStore
{ /* fields omitted */ }

Mutable slice iterator.

This struct is created by the iter_mut method on BitSlices.

Examples

Basic usage:

let mut data = 0u8;
let bits = data.bits_mut::<BigEndian>();
assert!(bits.not_any());
for mut bit in bits.iter_mut() {
    *bit = true;
}
assert!(bits.all());

Methods

impl<'a, C, T> IterMut<'a, C, T> where
    C: Cursor,
    T: 'a + BitStore
[src]

pub fn into_bitslice(self) -> &'a mut BitSlice<C, T>[src]

Views the underlying data as a subslice of the original data.

To avoid creating &mut references that alias, this is forced to consume the iterator.

Examples

Basic usage:

let mut data = 0u8;
let bits = data.bits_mut::<BigEndian>();

{
    // Get an iterator over the bits:
    let mut iter = bits.iter_mut();
    // Advance to the next bit:
    iter.next();
    // If we print this bitslice, it will be seven bits long.
    println!("{}", iter.into_bitslice());
}

// Now let’s modify a bit of the slice:
{
    // Rebuild the iterator:
    let mut iter = bits.iter_mut();
    // Change the value of the first bit:
    *iter.next().unwrap() = true;
}
assert!(bits[0]);
println!("{}", bits); // [10000000]

pub fn into_slice(self) -> &'a mut [T][src]

Views the underlying buffer.

To avoid creating &mut references that alias, this is forced to consume the iterator.

Trait Implementations

impl<'a, C, T> DoubleEndedIterator for IterMut<'a, C, T> where
    C: Cursor,
    T: 'a + BitStore
[src]

impl<'_, C, T> ExactSizeIterator for IterMut<'_, C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<'a, C, T> Iterator for IterMut<'a, C, T> where
    C: Cursor,
    T: 'a + BitStore
[src]

type Item = BitMut<'a, C, T>

The type of the elements being iterated over.

impl<'a, C: Debug, T: Debug> Debug for IterMut<'a, C, T> where
    C: Cursor,
    T: 'a + BitStore
[src]

impl<'_, C, T> FusedIterator for IterMut<'_, C, T> where
    C: Cursor,
    T: BitStore
[src]

Auto Trait Implementations

impl<'a, C, T> Send for IterMut<'a, C, T>

impl<'a, C, T> Sync for IterMut<'a, C, T>

impl<'a, C, T> Unpin for IterMut<'a, C, T>

impl<'a, C, T> !UnwindSafe for IterMut<'a, C, T>

impl<'a, C, T> RefUnwindSafe for IterMut<'a, C, T> where
    C: RefUnwindSafe,
    T: RefUnwindSafe

Blanket Implementations

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 = !

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.

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

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

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