pub struct StateMap { /* private fields */ }Expand description
A type-map for storing application state values.
Each value is keyed by its Rust type (TypeId). At most one value per
type can be stored. Uses HashMap for O(1) lookup.
§Example
use afast::state::StateMap;
struct MyConfig {
db_url: String,
}
let mut map = StateMap::new();
map.insert(MyConfig { db_url: "localhost".into() });
assert!(map.get::<MyConfig>().is_some());Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for StateMap
impl !UnwindSafe for StateMap
impl Freeze for StateMap
impl Send for StateMap
impl Sync for StateMap
impl Unpin for StateMap
impl UnsafeUnpin for StateMap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more