From c6bf1525d84128e06360c01e3ba5309a0d893146 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Thu, 11 Jan 2024 02:20:16 +0100 Subject: [PATCH] chore: add macro for caching lazy strings --- app/src/main.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/src/main.rs b/app/src/main.rs index c856b91..771c16b 100644 --- a/app/src/main.rs +++ b/app/src/main.rs @@ -132,3 +132,14 @@ fn init_logger() { tracing_subscriber::registry().with(log_filter).init(); } + + +#[macro_export] +macro_rules! cache_dynamic_lazy { + ( $( $visible:vis static $variable:ident: $type:ty = $expression:expr; )+ ) => { + $( + #[static_init::dynamic(lazy)] + $visible static $variable: $type = $expression; + )+ + }; +} \ No newline at end of file