From fc0d77d6838b16d811ffe5e999d3d77d499b470f Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sat, 8 Aug 2026 15:23:24 +0800 Subject: chore: initialize project workspace and movement plugin --- utils/macro_rules/Cargo.toml | 6 ++++++ utils/macro_rules/src/lib.rs | 29 +++++++++++++++++++++++++++++ utils/macros/Cargo.toml | 12 ++++++++++++ utils/macros/src/lib.rs | 5 +++++ 4 files changed, 52 insertions(+) create mode 100644 utils/macro_rules/Cargo.toml create mode 100644 utils/macro_rules/src/lib.rs create mode 100644 utils/macros/Cargo.toml create mode 100644 utils/macros/src/lib.rs (limited to 'utils') diff --git a/utils/macro_rules/Cargo.toml b/utils/macro_rules/Cargo.toml new file mode 100644 index 0000000..18cc902 --- /dev/null +++ b/utils/macro_rules/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "ch-macro-rules" +version.workspace = true +edition.workspace = true + +[dependencies] 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::*; + )+ + }; +} diff --git a/utils/macros/Cargo.toml b/utils/macros/Cargo.toml new file mode 100644 index 0000000..51e4564 --- /dev/null +++ b/utils/macros/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "ch-macros" +version.workspace = true +edition.workspace = true + +[lib] +proc-macro = true + +[dependencies] +quote.workspace = true +syn.workspace = true +proc-macro2.workspace = true diff --git a/utils/macros/src/lib.rs b/utils/macros/src/lib.rs new file mode 100644 index 0000000..ab369aa --- /dev/null +++ b/utils/macros/src/lib.rs @@ -0,0 +1,5 @@ +//! CH Utilities - Macros +//! +//! Provides convenient macros for developing the game CH + +#![deny(missing_docs)] -- cgit