pub struct Context<'s, S = ()> {
pub state: &'s mut S,
}
Fields§
§state: &'s mut S
Implementations§
Source§impl<'s, S> Context<'s, S>
impl<'s, S> Context<'s, S>
pub fn from_state(state: &'s mut S) -> Self
pub fn with_state<'q, U>(self, state: &'q mut U) -> Context<'q, U>
Sourcepub fn reborrow<'q>(&'q mut self) -> Context<'q, S>where
's: 'q,
pub fn reborrow<'q>(&'q mut self) -> Context<'q, S>where
's: 'q,
Reborrows the interior of the Context
.
This function constructs a Context
from this one by reborrowing its reference fields. In
particular, this reborrows state
and provides an ergonomic way to forward a Context
from one Reactor
to another. It is not the Context
that is borrowed in
Reactor::react
, but the fields (state
).
Trait Implementations§
Auto Trait Implementations§
impl<'s, S> Freeze for Context<'s, S>
impl<'s, S> RefUnwindSafe for Context<'s, S>where
S: RefUnwindSafe,
impl<'s, S> Send for Context<'s, S>where
S: Send,
impl<'s, S> Sync for Context<'s, S>where
S: Sync,
impl<'s, S> Unpin for Context<'s, S>
impl<'s, S = ()> !UnwindSafe for Context<'s, S>
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
§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,
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