Macro Enum

Source
Enum!() { /* proc-macro */ }
Expand description

This macro can be used to retrieve the marker component generated by the EnumFilter derive for the given enum value.

Because this macro relies on the module generated by the EnumFilter derive macro, you must make sure it is in scope. Otherwise, you’ll likely run into a compile error.

§Example

The basic usage of this macro looks like this:

type Marker = Enum!(Enum::Variant);
// or, Enum!(path::to::Enum::Variant)

Note: It doesn’t matter whether Enum::Variant is a unit, tuple, or struct variant— you do not need to specify any fields. Treat all variants like a unit variant.

// Make sure everything is in scope
use path::to::{Foo, foo_filters};
type Marker = Enum!(Foo::Baz);