Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Local Static

One-time mutable references to your local static variables.

#[local_static]
fn main() {
    static mut FOO: u32 = 0;
    *FOO = 42;
}

Limitation

Functions with #[local_static] attribute can only be called once.

Goals

  • Safe &'static mut references to local static mut variables.
  • Support for #[link_section] attribute.
  • Similar limitation and errors as regular static mut.

Acknowledgements

This crate is a generalization of a similar transformation done by the #[entry] macro in the cortex_m_rt crate.

Related work

  • static-cell provides a wrapper type that gives a &'static mut T to its internals in a safe way.

About

One-time mutable references to your local static variables

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages