pub struct Context<C> { /* private fields */ }Expand description
Supervisor-owned runtime context for one service execution.
Every supervised task receives:
- a
CancellationTokencontrolled by the supervisor - a typed service-local payload
C
The token makes shutdown cooperative and explicit, while the payload keeps service dependencies local instead of forcing a monolithic app context.
Implementations§
Source§impl<C> Context<C>
impl<C> Context<C>
pub fn new(token: CancellationToken, ctx: C) -> Self
pub fn token(&self) -> &CancellationToken
pub fn readiness(&self) -> &ReadySignal
pub fn ctx(&self) -> &C
pub fn into_inner(self) -> C
pub fn map<D>(self, map: impl FnOnce(C) -> D) -> Context<D>
Trait Implementations§
Auto Trait Implementations§
impl<C> Freeze for Context<C>where
C: Freeze,
impl<C> RefUnwindSafe for Context<C>where
C: RefUnwindSafe,
impl<C> Send for Context<C>where
C: Send,
impl<C> Sync for Context<C>where
C: Sync,
impl<C> Unpin for Context<C>where
C: Unpin,
impl<C> UnsafeUnpin for Context<C>where
C: UnsafeUnpin,
impl<C> UnwindSafe for Context<C>where
C: 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§impl<S> FromSupervisorState<S> for Swhere
S: Clone,
impl<S> FromSupervisorState<S> for Swhere
S: Clone,
Source§fn from_state(state: &S) -> S
fn from_state(state: &S) -> S
Projects
Self out of the root supervisor state.