#[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,
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> IntoAny for T
impl<T> IntoAny for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more