Function bitvec::slice::from_raw_parts_mut [−][src]
pub unsafe fn from_raw_parts_mut<'a, O, T>(
data: *mut T,
len: usize
) -> &'a mut BitSlice<O, T>ⓘ where
O: BitOrder,
T: 'a + BitStore + BitMemory,
Expand description
Performs the same functionality as from_raw_parts
, except that a mutable
bitslice is returned.
Original
Safety
Behavior is undefined if any of the following conditions are violated:
data
must be valid forlen * mem::size_of::<T>()
many bytes, and it must be properly aligned. This means in particular:- The entire memory range of this slice must be contained within a single allocated object! Slices can never span across multiple allocated objects.
data
must be non-null and aligned even for zero-length slices. The&BitSlice
pointer encoding requires this porperty to hold. You can obtain a pointer that is usable asdata
for zero-length slices usingNonNull::dangling()
.
- The memory referenced by the returned bitslice must not be accessed
through other pointer (not derived from the return value) for the duration
of the lifetime
'a
. Both read and write accesses are forbidden. - The total size
len * T::Mem::BITS
of the slice must be no larger thanBitSlice::<_, T>::MAX_BITS
.