aboutsummaryrefslogtreecommitdiff
path: root/mingling_macros
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-05-07 13:21:54 +0800
committer魏曹先生 <1992414357@qq.com>2026-05-07 13:21:54 +0800
commit11f32d55a79853ae764d2cf7c07e7174ccb0c239 (patch)
tree6f5a61c5eabff73d8ad0ee8ccf73d962faf01288 /mingling_macros
parent89571fa6ef2ffb5e044d714627460a46e7f76ca2 (diff)
Add static accessor to gen_program! macro output
Diffstat (limited to 'mingling_macros')
-rw-r--r--mingling_macros/src/lib.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/mingling_macros/src/lib.rs b/mingling_macros/src/lib.rs
index 818cda6..6d38889 100644
--- a/mingling_macros/src/lib.rs
+++ b/mingling_macros/src/lib.rs
@@ -1220,9 +1220,15 @@ pub fn program_final_gen(input: TokenStream) -> TokenStream {
}
impl #name {
+ /// Creates a new `Program<#name>` instance with default configuration.
pub fn new() -> ::mingling::Program<#name> {
::mingling::Program::new()
}
+
+ /// Returns a static reference to the global `Program<#name>` singleton.
+ pub fn this() -> &'static ::mingling::Program<#name> {
+ &::mingling::this::<#name>()
+ }
}
};