feat: create util module with shared mk_static macro

This commit is contained in:
2026-05-10 13:47:26 +02:00
parent f101de1618
commit 35691ef953
2 changed files with 11 additions and 0 deletions

View File

@@ -71,6 +71,7 @@ mod mqtt;
mod network;
mod plant_state;
mod tank;
mod util;
mod webserver;
extern crate alloc;

10
rust/src/util.rs Normal file
View File

@@ -0,0 +1,10 @@
macro_rules! mk_static {
($t:ty,$val:expr) => {{
static STATIC_CELL: static_cell::StaticCell<$t> = static_cell::StaticCell::new();
#[deny(unused_attributes)]
let x = STATIC_CELL.uninit().write(($val));
x
}};
}
pub(crate) use mk_static;