Crate but_what_about[−][src]
Expand description
The crate is basically just a permutation utility. With the goal of speed and the smallest possible runtime memory impact possible. And so, the goal of this crate is to be able to calculate and obtain a permutation of a value as soon as possible.
Examples
Get all the permutations of a string of three characters:
use heap_permute::PermuteIter; // Print all of the permutations of a string of three characters fn main() { const STRING: &'static str = "ABC"; for p in PermuteIter::from(STRING) { println!("{}", p); } } // Prints: // ABC // BAC // CAB // ACB // BCA // CBA
Now time for something more interesting, let’s permute the bits in a u8:
use heap_permute::PermuteIter; fn main() { for p in PermuteIter::from(0b1010_1001 as u8) { println!("0b{:08b} ({})", p, p); } } // Prints: // 0b10101001 (169) // 0b10101010 (170) // 0b10101010 (170) // 0b10101001 (169) // 0b10101100 (172) // 0b10101100 (172) // 0b10100101 (165) // 0b10100110 (166) // 0b10100011 (163) // 0b10100011 (163) // ...
As it happens, the crate supports permutation for all of the primitive numeric rust types.
Structs
Iterator over the permutations of a permutable type
Traits
Represents any type that the heap algorithm can generate permutations for