globals 0.1.0

Painless global variables in Rust
Documentation

Globals

Painless globals in Rust. Works with any type that implements Default trait.

[dependencies]
globals = "0.1.0"

Example

struct Foo {
  v:u32
}

impl Default for Foo {
  fn default() -> Self {
    Foo {v:42}
  }
}

let f = globals::get<Foo>().lock();

assert_eq!(f.v,42);

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in globals by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.