Function swap3::slice::bca_unsafe
source · pub fn bca_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 ofdata[b]
.b
- The second index, to be assigned with the value ofdata[c]
.c
- The third index, to be assigned with the value ofdata[a]
.
§Example
let mut vec = vec![50, 10, 90, 25, 30, 75];
swap3::slice::bca_unsafe(&mut vec, 0, 1, 4);
assert_eq!(vec, &[10, 30, 90, 25, 50, 75]);