pub trait SlicePermute<T>: Slice<Item = T> {
// Required methods
const fn bit_rev_permutation(&mut self);
const fn digit_rev_permutation(&mut self, radix: usize);
const fn grey_code_permutation(&mut self);
}Required Methods§
Sourceconst fn bit_rev_permutation(&mut self)
const fn bit_rev_permutation(&mut self)
Performs the bit-reverse permutation. Length must be a power of 2.
§Example
use slice_ops::ops::*;
let mut arr = [0b000, 0b001, 0b010, 0b011, 0b100, 0b101, 0b110, 0b111];
arr.bit_rev_permutation();
assert_eq!(arr, [0b000, 0b100, 0b010, 0b110, 0b001, 0b101, 0b011, 0b111])Sourceconst fn digit_rev_permutation(&mut self, radix: usize)
const fn digit_rev_permutation(&mut self, radix: usize)
Performs the digit-reverse permutation with any radix. Length must be a power of the radix.
§Example
use slice_ops::ops::*;
let mut arr = [0b000, 0b001, 0b010, 0b011, 0b100, 0b101, 0b110, 0b111];
arr.digit_rev_permutation(2);
assert_eq!(arr, [0b000, 0b100, 0b010, 0b110, 0b001, 0b101, 0b011, 0b111])Sourceconst fn grey_code_permutation(&mut self)
const fn grey_code_permutation(&mut self)
Performs the grey code permutation. Length must be a power of 2.
§Example
use slice_ops::ops::*;
let mut arr = [0b000, 0b001, 0b010, 0b011, 0b100, 0b101, 0b110, 0b111];
arr.as_mut_slice().grey_code_permutation();
assert_eq!(arr, [0b000, 0b001, 0b011, 0b010, 0b110, 0b111, 0b101, 0b100])Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.