Function swap3::slice::cab_unsafe

source ·
pub fn cab_unsafe<T>(data: &mut [T], a: usize, b: usize, c: usize)
Available on crate feature unsafe only.
Expand description

Rotates three values to the left.

§Arguments

  • data - The slice whose elements to swap.
  • a - The first index, to be assigned with the value of data[b].
  • b - The second index, to be assigned with the value of data[c].
  • c - The third index, to be assigned with the value of data[a].

§Example

let mut vec = vec![50, 10, 90, 25, 30, 75];
swap3::slice::cab_unsafe(&mut vec, 0, 1, 4);
assert_eq!(vec, &[30, 50, 90, 25, 10, 75]);