Struct bv::BitSliceMut [−][src]
A mutable slice of a bit-vector; akin to &'a mut [bool]
but packed.
Examples
use bv::*; let mut array = [0b00110101u16]; { let mut slice = BitSliceMut::from_slice(&mut array); assert_eq!( slice[0], true ); assert_eq!( slice[1], false ); slice.set_bit(0, false); } assert_eq!( array[0], 0b00110100u16 );
Implementations
impl<'a, Block: BlockType> BitSliceMut<'a, Block>
[src][−]
pub fn from_slice(blocks: &mut [Block]) -> Self
[src][−]
Creates a BitSliceMut
from a mutable array slice of blocks.
The size is always a multiple of Block::nbits()
. If you want a different size,
slice.
pub unsafe fn from_raw_parts(bits: *mut Block, offset: u64, len: u64) -> Self
[src][−]
Creates a BitSliceMut
from a pointer to its data, an offset where the bits start, and
the number of available bits.
This is unsafe because the size of the passed-in buffer is
not checked. It must hold at least offset + len
bits or the resulting behavior is
undefined.
Precondition
- the first
Block::ceil_div_nbits(len + offset)
words ofbits
safe to read and write.
pub fn len(&self) -> u64
[src][−]
The number of bits in the slice.
pub fn is_empty(&self) -> bool
[src][−]
Returns whether there are no bits in the slice.
pub fn as_bit_slice(&self) -> BitSlice<'a, Block>
[src][−]
Converts a mutable bit slice to immutable.
Trait Implementations
impl<'a, Block: BlockType> BitSliceable<Range<u64>> for BitSliceMut<'a, Block>
[src][+]
impl<'a, Block: BlockType> BitSliceable<RangeFrom<u64>> for BitSliceMut<'a, Block>
[src][+]
impl<'a, Block: BlockType> BitSliceable<RangeFull> for BitSliceMut<'a, Block>
[src][+]
impl<'a, Block: BlockType> BitSliceable<RangeInclusive<u64>> for BitSliceMut<'a, Block>
[src][+]
impl<'a, Block: BlockType> BitSliceable<RangeTo<u64>> for BitSliceMut<'a, Block>
[src][+]
impl<'a, Block: BlockType> BitSliceable<RangeToInclusive<u64>> for BitSliceMut<'a, Block>
[src][+]
impl<'a, Block: BlockType> Bits for BitSliceMut<'a, Block>
[src][+]
impl<'a, Block: BlockType> BitsMut for BitSliceMut<'a, Block>
[src][+]
impl<'a, Block: BlockType> Debug for BitSliceMut<'a, Block>
[src][+]
impl<'a, Block: BlockType> Eq for BitSliceMut<'a, Block>
[src]
impl<'a, Block: BlockType> From<&'a mut [Block]> for BitSliceMut<'a, Block>
[src][+]
impl<'a, 'b, Block: BlockType> From<&'b BitSliceMut<'a, Block>> for BitSlice<'a, Block>
[src][+]
impl<'a, Block: BlockType + Hash> Hash for BitSliceMut<'a, Block>
[src][+]
impl<'a, Block: BlockType> Index<u64> for BitSliceMut<'a, Block>
[src][+]
impl<'a, Block: BlockType> Ord for BitSliceMut<'a, Block>
[src][+]
impl<'a, Other: Bits> PartialEq<Other> for BitSliceMut<'a, Other::Block>
[src][+]
impl<'a, Block: BlockType> PartialOrd<BitSliceMut<'a, Block>> for BitSliceMut<'a, Block>
[src][+]
Auto Trait Implementations
impl<'a, Block> RefUnwindSafe for BitSliceMut<'a, Block> where
Block: RefUnwindSafe,
Block: RefUnwindSafe,
impl<'a, Block> !Send for BitSliceMut<'a, Block>
impl<'a, Block> !Sync for BitSliceMut<'a, Block>
impl<'a, Block> Unpin for BitSliceMut<'a, Block>
impl<'a, Block> !UnwindSafe for BitSliceMut<'a, Block>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,