Function odds::slice::rotate_left
[−]
[src]
pub fn rotate_left<T>(data: &mut [T], steps: usize)
Rotate steps
towards lower indices.
The steps to rotate is computed modulo the length of data
,
so any step value is acceptable. This function does not panic.
use odds::slice::rotate_left; let mut data = [1, 2, 3, 4]; rotate_left(&mut data, 1); assert_eq!(&data, &[2, 3, 4, 1]); rotate_left(&mut data, 2); assert_eq!(&data, &[4, 1, 2, 3]);