From ca7527681b609fedc368ea973022b004469035e6 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 29 Jun 2026 03:54:54 +0800 Subject: 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. --- just_template/src/template.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'just_template/src/template.rs') diff --git a/just_template/src/template.rs b/just_template/src/template.rs index e368917..953d7a5 100644 --- a/just_template/src/template.rs +++ b/just_template/src/template.rs @@ -1,9 +1,18 @@ use std::collections::HashMap; +/// Template struct, used to represent a template composed of a template string and parameters. +/// +/// # Fields +/// - `template_str` - Template string containing placeholders. +/// - `params` - Normal parameters, key-value mappings. +/// - `impl_params` - Implementation block parameters, where each implementation block name corresponds to a list of parameter maps (each parameter map is a key-value mapping). #[derive(Default, Clone)] pub struct Template { + /// Template string containing placeholders such as `{{param_name}}`. pub(crate) template_str: String, + /// Normal parameters, keyed by parameter name with values as parameter values. pub(crate) params: HashMap, + /// Implementation block parameters, keyed by implementation block name with values as a list of parameter maps. pub(crate) impl_params: HashMap>>, } -- cgit