pub struct ActorHandle<A: Actor> { /* private fields */ }Expand description
ActorHandles represent a (local) serving actor. It is used to access its messaging and signal ports, as well as to synchronize with its lifecycle (e.g., providing joins). Once dropped, the handle is detached from the underlying actor instance, and there is no longer any way to join it.
Correspondingly, crate::ActorAddrs refer to (possibly) remote
actors.
Implementations§
Source§impl<A: Actor> ActorHandle<A>
A handle to a running (local) actor.
impl<A: Actor> ActorHandle<A>
A handle to a running (local) actor.
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 bind<R: Binds<A>>(&self) -> ActorRef<R>
pub fn bind<R: Binds<A>>(&self) -> ActorRef<R>
TEMPORARY: bind… TODO: we shoudl also have a default binding(?)
Sourcepub fn into_any(self) -> AnyActorHandle
pub fn into_any(self) -> AnyActorHandle
Erase this handle’s actor type, preserving only lifecycle access.
Trait Implementations§
Source§impl<A: Actor> Clone for ActorHandle<A>
impl<A: Actor> Clone for ActorHandle<A>
Source§impl<A: Actor> Debug for ActorHandle<A>
impl<A: Actor> Debug for ActorHandle<A>
Source§impl<A, M> Endpoint<M> for &ActorHandle<A>
impl<A, M> Endpoint<M> for &ActorHandle<A>
Source§fn endpoint_location(&self) -> EndpointLocation
fn endpoint_location(&self) -> EndpointLocation
Source§impl<A: Actor> IntoFuture for ActorHandle<A>
IntoFuture allows users to await the handle to join it. The future
resolves when the actor itself has stopped processing messages.
The future resolves to the actor’s final status.
impl<A: Actor> IntoFuture for ActorHandle<A>
IntoFuture allows users to await the handle to join it. The future resolves when the actor itself has stopped processing messages. The future resolves to the actor’s final status.
Source§type Output = ActorStatus
type Output = ActorStatus
Source§type IntoFuture = Pin<Box<dyn Future<Output = <ActorHandle<A> as IntoFuture>::Output> + Send>>
type IntoFuture = Pin<Box<dyn Future<Output = <ActorHandle<A> as IntoFuture>::Output> + Send>>
Source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Source§impl<A> MailboxAdminMessageClient for ActorHandle<A>where
A: Handler<MailboxAdminMessage>,
impl<A> MailboxAdminMessageClient for ActorHandle<A>where
A: Handler<MailboxAdminMessage>,
Source§fn update_address<'life0, 'life1, 'async_trait>(
&'life0 self,
cx: &'life1 (impl 'async_trait + Actor),
proc_id: ProcAddr,
addr: ChannelAddr,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_address<'life0, 'life1, 'async_trait>(
&'life0 self,
cx: &'life1 (impl 'async_trait + Actor),
proc_id: ProcAddr,
addr: ChannelAddr,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn update_address_deprecated<'life0, 'life1, 'async_trait>(
&'life0 self,
cx: &'life1 (impl 'async_trait + Actor),
proc_id: ProcAddr,
addr: ChannelAddr,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_address_deprecated<'life0, 'life1, 'async_trait>(
&'life0 self,
cx: &'life1 (impl 'async_trait + Actor),
proc_id: ProcAddr,
addr: ChannelAddr,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl<A> Freeze for ActorHandle<A>
impl<A> !RefUnwindSafe for ActorHandle<A>
impl<A> Send for ActorHandle<A>
impl<A> Sync for ActorHandle<A>
impl<A> Unpin for ActorHandle<A>
impl<A> UnsafeUnpin for ActorHandle<A>
impl<A> !UnwindSafe for ActorHandle<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
Source§impl<A, M> Handler<IndexedErasedUnbound<M>> for A
impl<A, M> Handler<IndexedErasedUnbound<M>> for A
§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>
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>
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>
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>,
Layered].