Function didyoumean::insert_and_shift
source · [−]Expand description
Insert element
at index
preserving length.
Arguments
list
- A vec to be shifted downindex
- The index at which to insertelement
element
- The element to insert atindex
Examples
let mut to_shift = vec![0, 1, 2, 3, 4];
insert_and_shift(&mut to_shift, 2, 11);
assert_eq!(to_shift, vec![0, 1, 11, 2, 3]);