#[repr(transparent)]pub struct Stateful<F>(pub F);
Expand description
A marker type that indicates that an extractor’s first parameter accepts handler state.
When using state, the type of the state must be fully qualified and cannot be inferred. For more complex state types, consider using a type definition.
§Examples
This type must be used to interact with handler state within an extractor. The following constructs an event handler that runs and matches when a management frame can be extracted from an event and has exclusive access to state when it runs.
ⓘ
let mut handler = event::extract(Stateful(|state: &mut State, frame: Buffered<MgmtFrame>| {
/* ... */
}));
Tuple Fields§
§0: F
Trait Implementations§
impl<F: Copy> Copy for Stateful<F>
Auto Trait Implementations§
impl<F> Freeze for Stateful<F>where
F: Freeze,
impl<F> RefUnwindSafe for Stateful<F>where
F: RefUnwindSafe,
impl<F> Send for Stateful<F>where
F: Send,
impl<F> Sync for Stateful<F>where
F: Sync,
impl<F> Unpin for Stateful<F>where
F: Unpin,
impl<F> UnwindSafe for Stateful<F>where
F: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)