Function scratchpad::uninitialized_boxed_slice_for_bytes
[−]
[src]
pub unsafe fn uninitialized_boxed_slice_for_bytes<T>(bytes: usize) -> Box<[T]> where
T: ByteData,
Returns a boxed slice of uninitialized data large enough to hold at least the specified number of bytes.
Safety
The contents of the boxed slice are left uninitialized; reading from and writing to the slice contents can trigger undefined behavior if not careful.
Examples
use scratchpad::uninitialized_boxed_slice_for_bytes; let buffer = unsafe { uninitialized_boxed_slice_for_bytes::<u32>(32) }; assert_eq!(buffer.len(), 8);