enumiter 0.1.0

An iterator through the variants in an enum.
Documentation
  • Coverage
  • 40%
    2 out of 5 items documented0 out of 4 items with examples
  • Size
  • Source code size: 4.64 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • Documentation
  • cgaebel/enumiter
    0 0 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • cgaebel

EnumIter

crates.io

Build Status

A simple iterator through the different variants in an enum.

Example

  use enumiter::{enum_iter, AllVariantsTakeNoParameters};

  #[derive(Clone, Copy, PartialEq, Eq, Debug)]
  enum Test {
    One,
    Two,
    Three,
  }

  unsafe impl AllVariantsTakeNoParameters for Test {}

  #[test]
  fn it_works() {
    let mut vals = Vec::new();

    let _ = Test::Two; // ignore dead code warning.

    for x in enum_iter(Test::One, Test::Three) {
      vals.push(x);
    }

    assert_eq!(format!("{:?}", vals), "[One, Two, Three]");
  }

Documentation

See the very thorough API Docs.