state_department/
lib.rs

1#![doc = include_str!("../README.md")]
2#![deny(missing_docs)]
3#![cfg_attr(docsrs, feature(doc_cfg))]
4
5const UNINITIALIZED: u8 = 0;
6const INITIALIZING: u8 = 1;
7const INITIALIZED: u8 = 2;
8
9#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
10#[cfg(feature = "async")]
11mod r#async;
12mod lazy;
13mod manager;
14mod state;
15
16pub use manager::*;
17pub use state::AnyContext;
18
19/// State manager for any (synchronous or asynchronous) contexts.
20pub type State = manager::StateManager<AnyContext>;
21
22/// State manager for asynchronous-only contexts.
23///
24/// This state manager is an extension of [`State`] but allows you to register
25/// and get `async` lazy initialized global state (see
26/// [`StateRegistry::insert_async_lazy`])
27#[cfg(feature = "async")]
28#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
29pub type AsyncState = manager::StateManager<AsyncOnlyContext>;
30
31#[cfg(feature = "async")]
32#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
33pub use r#async::AsyncOnlyContext;