Skip to main content

slice_mut

Function slice_mut 

Source
pub fn slice_mut<const T: usize>(data: &mut [u8], offset: usize) -> &mut [u8; T]
Expand description

Returns a mutable slice of the given data with the specified length

§Arguments

  • data - The data to slice
  • offset - The offset to start the slice

§Returns

A mutable slice of the given data with the specified length

§Example

let mut data = [1, 2, 3, 4, 5];
let sliced = slice_mut::<3>(&mut data, 1);
assert_eq!(sliced, [2, 3, 4]);