One-time mutable references to your local static variables.
#[local_static]
fn main() {
static mut FOO: u32 = 0;
*FOO = 42;
}Functions with #[local_static] attribute can only be called once.
- Safe
&'static mutreferences to localstatic mutvariables. - Support for
#[link_section]attribute. - Similar limitation and errors as regular
static mut.
This crate is a generalization of a similar transformation done by the #[entry] macro in the cortex_m_rt crate.
- static-cell provides a wrapper type that gives a
&'static mut Tto its internals in a safe way.