From 35691ef953ff8eb038802b3756f1059887866a05 Mon Sep 17 00:00:00 2001 From: ju6ge Date: Sun, 10 May 2026 13:47:26 +0200 Subject: [PATCH] feat: create util module with shared mk_static macro --- rust/src/main.rs | 1 + rust/src/util.rs | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 rust/src/util.rs diff --git a/rust/src/main.rs b/rust/src/main.rs index 859509d..92b21c2 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -71,6 +71,7 @@ mod mqtt; mod network; mod plant_state; mod tank; +mod util; mod webserver; extern crate alloc; diff --git a/rust/src/util.rs b/rust/src/util.rs new file mode 100644 index 0000000..9241868 --- /dev/null +++ b/rust/src/util.rs @@ -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;