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>

Notable traits for &'a BitSlice<O, T>

impl<'a, O, T> Read for &'a BitSlice<O, T> where
    O: BitOrder,
    T: BitStore,
    BitSlice<O, T>: BitField
impl<'a, O, T> Write for &'a mut BitSlice<O, T> where
    O: BitOrder,
    T: BitStore,
    BitSlice<O, T::Alias>: BitField
where
    O: BitOrder,
    T: 'a + BitStore + BitMemory

Performs the same functionality as from_raw_parts, except that a mutable bitslice is returned.

Original

slice::from_raw_parts_mut

Safety

Behavior is undefined if any of the following conditions are violated:

  • data must be valid for len * 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 as data for zero-length slices using NonNull::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 than BitSlice::<_, T>::MAX_BITS.