Skip to main content

take_slice

Function take_slice 

Source
pub fn take_slice<T>(
    bytes: &mut [u8],
    len: usize,
) -> Option<(&mut [T], &mut [u8])>
Expand description

Takes a len element slice of T off the front of bytes, aligning first, and returns it along with what is left.

For carving one block into the several typed slices a caller needs, so that the whole of it is one allocation rather than one each.

Returns None when the block is of insufficient size.