State
A Rust library for safe and effortless global and thread-local state management.
extern crate state;
static GLOBAL: Storage = new;
GLOBAL.set;
assert_eq!;
See the documentation for more.
Usage
Include state
in your Cargo.toml
[dependencies]
:
[]
= "0.3"
Thread-local state management is not enabled by default. You can enable it
via the tls
feature:
[]
= { = "0.3", = ["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:
License
State is licensed under either of the following, at your option:
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)