#internally #macro #randtest #enum-iterator

yanked randtest_macros

Macros used internally by the randtest crates

Uses old Rust 2015

0.1.1 Aug 28, 2017
0.1.0 Aug 22, 2017

#26 in #internally


Used in 2 crates (via librandtest)

Apache-2.0/MIT

6KB
90 lines

randtest_macros

Procedural macros used internally by the randtest crate that are forced to be in a separate proc-macro type crate.


lib.rs:

Macros used internally by the randtest crate that are forced to be separated out into a crate with crate-type 'proc-macro' from the primary randtest crate.

EnumIterator Macro

This macro can be used to automatically derive an ::iterator() method on enum variants.

The implementation was largely copied and adapted for the randtest project from:

https://github.com/cbreeden/enum-iter

#[macro_use]
extern crate randtest_macros;

#[derive(EnumIterator, Debug)]
pub enum Foo {
    Bar,
    Baz,
    Boo,
}

fn main() {
    for variant in Foo::iterator() {
        println!("{:?}", variant);
    }
}

Dependencies

~1.5MB
~42K SLoC