pub struct ActorGuard<A: Actor> { /* private fields */ }Expand description
A guard that stops an actor when dropped.
Implementations§
Source§impl<A: Actor> ActorGuard<A>
impl<A: Actor> ActorGuard<A>
Sourcepub fn into_inner(self) -> ActorHandle<A>
pub fn into_inner(self) -> ActorHandle<A>
Return the actor handle without stopping the actor.
Methods from Deref<Target = ActorHandle<A>>§
Sourcepub fn actor_addr(&self) -> &ActorAddr
pub fn actor_addr(&self) -> &ActorAddr
The ActorAddr of the actor represented by this handle.
Sourcepub fn drain_and_stop(&self, reason: &str) -> Result<(), ActorError>
pub fn drain_and_stop(&self, reason: &str) -> Result<(), ActorError>
Signal the actor to drain its current messages and then stop.
Sourcepub fn stop(&self, reason: &str) -> Result<(), ActorError>
pub fn stop(&self, reason: &str) -> Result<(), ActorError>
Signal the actor to stop without draining ordinary queued work first.
Sourcepub fn kill(&self, reason: &str) -> Result<(), ActorError>
pub fn kill(&self, reason: &str) -> Result<(), ActorError>
Signal the actor to terminate immediately.
Sourcepub fn status(&self) -> Receiver<ActorStatus>
pub fn status(&self) -> Receiver<ActorStatus>
A watch that observes the lifecycle state of the actor.
Sourcepub fn port<M: Message>(&self) -> PortHandle<M>where
A: Handler<M>,
pub fn port<M: Message>(&self) -> PortHandle<M>where
A: Handler<M>,
Return a port for the provided message type handled by the actor.
Sourcepub fn try_post<C, M>(
&self,
cx: &C,
message: M,
) -> Result<(), MailboxSenderError>
pub fn try_post<C, M>( &self, cx: &C, message: M, ) -> Result<(), MailboxSenderError>
Post message to this actor’s handler port for M, returning an error
if delivery fails (the actor has stopped, its mailbox is closed, or the
underlying channel is disconnected). Unlike Endpoint::post, the
caller observes the failure instead of having it reported through the
actor’s lost-message channel.
Trait Implementations§
Source§impl<A: Actor> Debug for ActorGuard<A>
impl<A: Actor> Debug for ActorGuard<A>
Source§impl<A: Actor> Deref for ActorGuard<A>
impl<A: Actor> Deref for ActorGuard<A>
Auto Trait Implementations§
impl<A> Freeze for ActorGuard<A>
impl<A> !RefUnwindSafe for ActorGuard<A>
impl<A> Send for ActorGuard<A>
impl<A> Sync for ActorGuard<A>
impl<A> Unpin for ActorGuard<A>
impl<A> UnsafeUnpin for ActorGuard<A>
impl<A> !UnwindSafe for ActorGuard<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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].