A Rust library for safe and effortless global and thread-local state management.
```rust extern crate state;
static GLOBAL: state::Storage
GLOBAL.set(42); assert_eq!(*GLOBAL.get(), 42); ```
See the documentation for more.
Include state
in your Cargo.toml
[dependencies]
:
toml
[dependencies]
state = "0.3"
Thread-local state management is not enabled by default. You can enable it
via the tls
feature:
toml
[dependencies]
state = { version = "0.3", features = ["tls"] }
This crate requires Rust nightly due to the instability of the const_fn
and
drop_types_in_const
features. Ensure the features are enabled by adding the
following to your top-level crate attributes:
```rust
```
State is licensed under either of the following, at your option: