aboutsummaryrefslogtreecommitdiff
path: root/mingling_macros/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'mingling_macros/src/lib.rs')
-rw-r--r--mingling_macros/src/lib.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/mingling_macros/src/lib.rs b/mingling_macros/src/lib.rs
index 8c98ba3..57f37a1 100644
--- a/mingling_macros/src/lib.rs
+++ b/mingling_macros/src/lib.rs
@@ -33,6 +33,7 @@ mod dispatch_tree_gen;
mod dispatcher;
#[cfg(feature = "clap")]
mod dispatcher_clap;
+mod entry;
mod enum_tag;
mod groupped;
mod help;
@@ -776,6 +777,27 @@ pub fn dispatcher_clap(attr: TokenStream, item: TokenStream) -> TokenStream {
dispatcher_clap::dispatcher_clap_attr(attr, item)
}
+/// Creates a packed entry value from a list of string literals.
+///
+/// # Syntax
+///
+/// Two forms:
+///
+/// ```rust,ignore
+/// // With explicit type — expands to MyEntry::new(vec!["a".to_string(), ...])
+/// entry!(MyEntry, ["a", "b", "c"])
+///
+/// // Without type — use bracket syntax, expands to vec!["a".to_string(), ...].into()
+/// entry!["a", "b", "c"]
+/// ```
+///
+/// This is a convenience macro for constructing entry wrapper types (created
+/// via `pack!` or `dispatcher!`) with test data.
+#[proc_macro]
+pub fn entry(input: TokenStream) -> TokenStream {
+ entry::entry(input)
+}
+
/// Registers a help request mapping between an entry type and a help struct.
///
/// This macro is used internally by the `#[help]`(macro.help.html) attribute