Struct State
pub struct State<'a> { /* private fields */ }Expand description
A key’s state, as a handler sees it.
Implementations§
§impl State<'_>
impl State<'_>
pub fn get<T: DeserializeOwned>(&self, key: &str) -> Result<Option<T>>
pub fn set<T: Serialize>(&self, key: &str, value: &T) -> Result<()>
pub fn set<T: Serialize>(&self, key: &str, value: &T) -> Result<()>
Sets key (null clears it). Only an exclusive handler may.
pub fn set_raw(&self, key: &str, json: Payload) -> Result<()>
pub fn clear(&self, key: &str) -> Result<()>
Auto Trait Implementations§
impl<'a> Freeze for State<'a>
impl<'a> !RefUnwindSafe for State<'a>
impl<'a> !Send for State<'a>
impl<'a> !Sync for State<'a>
impl<'a> Unpin for State<'a>
impl<'a> UnsafeUnpin for State<'a>
impl<'a> !UnwindSafe for State<'a>
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