aboutsummaryrefslogtreecommitdiff
path: root/just_template/src/deprecated.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-06-29 03:54:54 +0800
committer魏曹先生 <1992414357@qq.com>2026-06-29 03:54:54 +0800
commitca7527681b609fedc368ea973022b004469035e6 (patch)
tree47109782fa5a4435889d93a823db3a4e1f5e7bd6 /just_template/src/deprecated.rs
parentba15b7c06468cb6c52c8d2a53419fd83f9ebcb8b (diff)
feat(just_template): add proc-macro `tmpl!` and restructure crate
Move the old `tmpl!` and `tmpl_param!` macros into a dedicated `just_template_macros` proc-macro crate. The new `tmpl!` macro supports both simple parameter assignment and multi-arm implementation blocks with per-arm overrides. Remove the deprecated `deprecated` module and update tests accordingly.
Diffstat (limited to 'just_template/src/deprecated.rs')
-rw-r--r--just_template/src/deprecated.rs45
1 files changed, 0 insertions, 45 deletions
diff --git a/just_template/src/deprecated.rs b/just_template/src/deprecated.rs
deleted file mode 100644
index b218969..0000000
--- a/just_template/src/deprecated.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-#[macro_export]
-macro_rules! tmpl_param {
- ($template:ident, $($key:ident = $value:expr),* $(,)?) => {{
- $(
- $template.insert_param(stringify!($key).to_string(), $value.to_string());
- )*
- }};
-}
-
-#[macro_export]
-macro_rules! tmpl {
- ($template:ident, $($name:ident {
- $($key:ident = $value:expr),* $(,)?
- }),* $(,)?) => {{
- $(
- let $name = $template.add_impl(stringify!($name).to_string());
- $(
- $name.push({
- let mut params = std::collections::HashMap::new();
- params.insert(stringify!($key).to_string(), $value.to_string());
- params
- });
- )*
- )*
- }};
-
- // Old syntax
- ($template:ident += {
- $($name:ident {
- $(($($key:ident = $value:expr),* $(,)?)),*
- $(,)?
- }),*
- }) => {{
- $(
- let $name = $template.add_impl(stringify!($name).to_string());
- $(
- $name.push({
- let mut params = std::collections::HashMap::new();
- $(params.insert(stringify!($key).to_string(), $value.to_string());)*
- params
- });
- )*
- )*
- }};
-}