Trait bitvec::slice::AsBits [−][src]
Allows a type to be used as a sequence of immutable bits.
Requirements
This trait can only be implemented by contiguous structures: individual fundamentals, and sequences (arrays or slices) of them.
Associated Types
Loading content...Required methods
fn bits<O>(&self) -> &BitSlice<O, Self::Store> where
O: BitOrder,
[src]
O: BitOrder,
Constructs a BitSlice
reference over data.
Type Parameters
O: BitOrder
: TheBitOrder
type used to index within the slice.
Parameters
&self
Returns
A BitSlice
handle over self
’s data, using the provided BitOrder
type and using Self::Store
as the data type.
Examples
use bitvec::prelude::*; let src = 8u8; let bits = src.bits::<Msb0>(); assert!(bits[4]);
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, Self::Store> where
O: BitOrder,
[src]
O: BitOrder,
Constructs a mutable BitSlice
reference over data.
Type Parameters
O: BitOrder
: TheBitOrder
type used to index within the slice.
Parameters
&mut self
Returns
A BitSlice
handle over self
’s data, using the provided BitOrder
type and using Self::Store
as the data type.
Examples
use bitvec::prelude::*; let mut src = 8u8; let bits = src.bits_mut::<Lsb0>(); assert!(bits[3]); *bits.at(3) = false; assert!(!bits[3]);
Implementations on Foreign Types
impl<T> AsBits for [T] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 0] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 1] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 2] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 3] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 4] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 5] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 6] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 7] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 8] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 9] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 10] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 11] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 12] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 13] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 14] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 15] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 16] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 17] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 18] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 19] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 20] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 21] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 22] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 23] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 24] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 25] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 26] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 27] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 28] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 29] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 30] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 31] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
impl<T> AsBits for [T; 32] where
T: BitStore,
[src]
T: BitStore,
type Store = T
fn bits<O>(&self) -> &BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,
fn bits_mut<O>(&mut self) -> &mut BitSlice<O, T> where
O: BitOrder,
[src]
O: BitOrder,