aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nitrocli/src/arg_util.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/nitrocli/src/arg_util.rs b/nitrocli/src/arg_util.rs
index 15ab730..cb75c52 100644
--- a/nitrocli/src/arg_util.rs
+++ b/nitrocli/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(", "),
)
)
}