feat: create util module with shared mk_static macro
This commit is contained in:
@@ -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
10
rust/src/util.rs
Normal 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;
|
||||
Reference in New Issue
Block a user