Skip to content

Commit

Permalink
feat: Update the mk_static macro
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-zero committed Nov 19, 2024
1 parent 60ff338 commit 0064f4e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/bin/async_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ use esp_wifi::{
EspWifiInitFor,
};

// When you are okay with using a nightly compiler it's better to use https://docs.rs/static_cell/2.1.0/static_cell/macro.make_static.html
// https://github.com/embassy-rs/static-cell/issues/16
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
STATIC_CELL.init_with(|| $val)
}};
}

Expand Down

0 comments on commit 0064f4e

Please sign in to comment.