Function bitvec::ptr::bitslice_from_raw_parts_mut [−][src]
pub fn bitslice_from_raw_parts_mut<O, T>(
data: BitPtr<Mut, O, T>,
len: usize
) -> *mut BitSlice<O, T> where
O: BitOrder,
T: BitStore,
Performs the same functionality as bitslice_from_raw_parts
, except that
a raw mutable bit-slice is returned, as opposed to a raw immutable bit-slice.
See the documentation of bitslice_from_raw_parts
for more details.
This function is safe, but actually using the return value is unsafe. See the
documentation of slice::from_raw_parts_mut
for bit-slice safety
requirements.
Original
Examples
use bitvec::ptr; use bitvec::order::Lsb0; let mut x = [5u8, 10, 15]; let bitptr = ptr::BitPtr::<_, Lsb0, _>::from_mut(&mut x[0]); let bitslice = ptr::bitslice_from_raw_parts_mut(bitptr, 24); unsafe { &mut *bitslice }.set(0, true); assert!(unsafe { &*bitslice }[0]);