but-what-about

Crates.iobut-what-about
lib.rsbut-what-about
version0.1.0
sourcesrc
created_at2021-06-27 22:09:31.805254
updated_at2021-06-27 22:09:31.805254
descriptionA permutation & combination calculation crate for rust.
homepage
repositoryhttps://github.com/micron-mushroom/but-what-about
max_upload_size
id415526
size13,721
(micron-mushroom)

documentation

README

but-what-about

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,
Commit count: 4

cargo fmt