Skip to main content

slice_from_raw_parts_mut

Function slice_from_raw_parts_mut 

Source
pub const unsafe fn slice_from_raw_parts_mut<'a, T>(
    data: *mut T,
    len: usize,
) -> &'a mut [T]
Expand description

Performs the same functionality as slice_from_raw_parts, except that a mutable slice is returned.

ยงSafety

If len > 0, data must satisfy the safety requirements of [core::slice::from_raw_parts_mut]: it must be non-null, valid for both reads and writes for len * mem::size_of::<T>() many bytes, properly aligned, and point to len consecutive properly initialized values of type T not accessed through any other pointer for the duration of lifetime 'a.