choose-from 0.1.1

Simple dependency-free crate for enforcing a selection from set values
Documentation
  • Coverage
  • 83.33%
    10 out of 12 items documented7 out of 9 items with examples
  • Size
  • Source code size: 20.23 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.47 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • xa888s/choose-from
    0 0 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • xa888s

Choose-from

Documentation

Simple Rust library for enforcing values are chosen from a set of values, using const generics, lifetimes, and more. Please see the docs for more information.

Example usage:

use choose_from::select_from_fixed;
let choices = ["Hi", "how", "are ya?"];

let chosen = select_from_fixed(choices).with(|[first, second, third]| {
    // the provided choices allow inspection of the values
    assert_eq!(*first, "Hi");
    
    // this is our selection
    [first, third]
});

assert_eq!(chosen, ["Hi", "are ya?"]);