chore: add macro for caching lazy strings

This commit is contained in:
Michael Aaron Murphy 2024-01-11 02:20:16 +01:00 committed by Michael Murphy
parent f2148eed9a
commit c6bf1525d8

View file

@ -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;
)+
};
}