enum_values/lib.rs
1#![doc = include_str!("../README.md")]
2
3/// Captures basic data on an enum variant.
4#[derive(Debug, Clone)]
5pub struct VariantInfo {
6 /// Name of the variant.
7 pub name: &'static str,
8
9 /// Value of the variant.
10 pub value: u16,
11
12 /// Documentation comment present on the variant.
13 pub doc: &'static str,
14}
15
16/// Exposes variants of the enum.
17pub trait EnumValues {
18 /// Return the iterator over all variants of this enum.
19 fn variants() -> impl Iterator<Item = VariantInfo>;
20}
21
22pub use enum_values_derive::EnumValues;