summaryrefslogtreecommitdiff
path: root/src/arg_util.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/arg_util.rs')
-rw-r--r--src/arg_util.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/arg_util.rs b/src/arg_util.rs
index 2f04ccd..8cd8fe5 100644
--- a/src/arg_util.rs
+++ b/src/arg_util.rs
@@ -83,6 +83,15 @@ macro_rules! enum_int {
)*
]
}
+
+ #[allow(unused)]
+ pub fn all_str() -> [&'static str; count!($($var),*)] {
+ [
+ $(
+ $str,
+ )*
+ ]
+ }
}
impl ::std::convert::AsRef<str> for $name {
@@ -112,11 +121,7 @@ macro_rules! enum_int {
_ => Err(
format!(
"expected one of {}",
- $name::all_variants()
- .iter()
- .map(::std::convert::AsRef::as_ref)
- .collect::<::std::vec::Vec<_>>()
- .join(", "),
+ $name::all_str().join(", "),
)
)
}