Trait bv::BitSliceable [−][src]
pub trait BitSliceable<Range>: Bits { type Slice: Bits<Block = Self::Block>; fn bit_slice(self, range: Range) -> Self::Slice; }
Expand description
Types that support slicing by ranges.
Note that the bit_slice
method takes self
by value, which allows
the Slice
associated type to refer to the lifetime of Self
in impls
for borrowed types. For example, the impl for &'a BitVec<u32>
has a
Slice
type of BitSlice<'a, u32>
.
Associated Types
Required methods
Slices or re-slices the given object.
Examples
use bv::{BitSlice, BitSliceable}; let array = [0b01010011u16]; let slice = BitSlice::from_slice(&array); assert_eq!( slice.bit_slice(1..3), slice.bit_slice(4..6) ); assert_eq!( slice.bit_slice(1..3), slice.bit_slice(6..8) ); assert_ne!( slice.bit_slice(2..4), slice.bit_slice(6..8) ); assert_eq!( slice.bit_slice(2..4), slice.bit_slice(7..9) );