chore: add macro for caching lazy strings
This commit is contained in:
parent
f2148eed9a
commit
c6bf1525d8
1 changed files with 11 additions and 0 deletions
|
|
@ -132,3 +132,14 @@ fn init_logger() {
|
||||||
|
|
||||||
tracing_subscriber::registry().with(log_filter).init();
|
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;
|
||||||
|
)+
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue