aboutsummaryrefslogtreecommitdiff
path: root/utils/macro_rules/src/lib.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-08-08 15:23:24 +0800
committer魏曹先生 <1992414357@qq.com>2026-08-08 15:23:24 +0800
commitfc0d77d6838b16d811ffe5e999d3d77d499b470f (patch)
tree00565a452f9045b4fb357ae04a1cae349163839a /utils/macro_rules/src/lib.rs
chore: initialize project workspace and movement plugin
Diffstat (limited to 'utils/macro_rules/src/lib.rs')
-rw-r--r--utils/macro_rules/src/lib.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/utils/macro_rules/src/lib.rs b/utils/macro_rules/src/lib.rs
new file mode 100644
index 0000000..cbc4730
--- /dev/null
+++ b/utils/macro_rules/src/lib.rs
@@ -0,0 +1,29 @@
+//! CH Utilities - Macro Rules
+//!
+//! Provides convenient macros for developing the game CH
+
+#![deny(missing_docs)]
+
+/// Import modules and re-export all of their public items.
+///
+/// This macro declares modules with `mod $module;` and then re-exports
+/// everything from them with `pub use $module::*;`, making the items of the
+/// modules available as if they were defined in the current scope.
+///
+/// Supports both single and multiple module imports:
+///
+/// # Examples
+///
+/// ```
+/// import!(my_module);
+/// import!(foo, bar, zsq);
+/// ```
+#[macro_export]
+macro_rules! import {
+ ($($module:ident),+ $(,)?) => {
+ $(
+ mod $module;
+ pub use $module::*;
+ )+
+ };
+}