repeat_fill

Function repeat_fill 

Source
pub fn repeat_fill<T>(slice: &mut [T], pattern: &[T])
where T: Copy,
Expand description

用模式重复填充数组/Repeat pattern to fill array

§参数/Arguments

  • slice - 要填充的数组/Array to fill
  • pattern - 重复模式/Pattern to repeat

§示例/Examples

use slice_reducer::repeat_fill;
let mut arr = [0; 5];
repeat_fill(&mut arr, &[1, 2]);
assert_eq!(arr, [1, 2, 1, 2, 1]);