Crates.io | but-what-about |
lib.rs | but-what-about |
version | 0.1.0 |
source | src |
created_at | 2021-06-27 22:09:31.805254 |
updated_at | 2021-06-27 22:09:31.805254 |
description | A permutation & combination calculation crate for rust. |
homepage | |
repository | https://github.com/micron-mushroom/but-what-about |
max_upload_size | |
id | 415526 |
size | 13,721 |
The crate is a permutation utility that only supports Heap's algorithm. At the moment it can permute strings(by grapheme and codepoint—though, codepoint based permutation is highly questionable at the moment) and primitive numeric types by their bits. In the future I plan to add support for additional permutation algorithms and implement some combination algorithms as well. I can't say I recomment using the crate for anything more than just fun at the moment. So, do go and have fun.
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) {
print!("{}, ", p);
}
}
// Prints:
// ABC, BAC, CAB, ACB, BCA, CBA,