Trait bitvec::view::BitView [−][src]
pub trait BitView {
type Store: BitStore;
type Mem: BitMemory;
fn view_bits<O>(&self) -> &BitSlice<O, Self::Store>ⓘ
where
O: BitOrder;
fn view_bits_mut<O>(&mut self) -> &mut BitSlice<O, Self::Store>ⓘ
where
O: BitOrder;
}
Expand description
Views a type that can store bits as a bit-slice.
This trait is implemented on all T: BitStore
types, and the arrays and slices
of them that are supported by the standard library.
This means that until type-level integers are stabilized, only arrays in
[T: BitStore; 0 ..= 32]
will implement the trait; wider arrays will need to
reborrow as slices [T]
in order to use the slice implementation.
If you have a type that contains a bit-storage type that can be viewed with this trait, then you can implement this trait by forwarding to the interior view.
Associated Types
Required methods
Views a memory region as a BitSlice
.
Type Parameters
O
: The bit ordering used for the region.
Parameters
&self
: The region to view as individual bits.
Returns
A &BitSlice
view over the region at *self
.
fn view_bits_mut<O>(&mut self) -> &mut BitSlice<O, Self::Store>ⓘ where
O: BitOrder,
fn view_bits_mut<O>(&mut self) -> &mut BitSlice<O, Self::Store>ⓘ where
O: BitOrder,
Views a memory region as a mutable BitSlice
.
Type Parameters
O
: The bit ordering used for the region.
Parameters
&self
: The region to view as individual mutable bits.
Returns
A &mut BitSlice
view over the region at *self
.