pub fn sized_slice<T, const ORIGINAL_SIZE: usize, const SLICE_SIZE: usize>(
original: [T; ORIGINAL_SIZE],
from: usize,
till: usize,
fill: T,
) -> [T; SLICE_SIZE]where
T: Copy,
Expand description
Create a sized slice of an array.
Create a copy a part of sized array original
from the index from
till the index till
.
Filling the elements which are are contained in the original
array with the fill
value.
ยงExamples
use array_utils::sized_slice;
assert_eq!(sized_slice([1, 2, 3, 4, 5, 6, 7, 8, 9], 2, 6, 0), [3, 4, 5, 6]);
assert_eq!(sized_slice([1, 2, 3, 4, 5, 6, 7, 8, 9], 6, 8, 0), [7, 8, 0, 0, 0, 0]);