pub struct ActrRef { /* private fields */ }Expand description
ActrRef - Lightweight reference to a running Actor
This is the primary handle returned by ActrNode::start().
Implementations§
Source§impl ActrRef
impl ActrRef
Sourcepub async fn call<R: RpcRequest>(&self, request: R) -> ActorResult<R::Response>
pub async fn call<R: RpcRequest>(&self, request: R) -> ActorResult<R::Response>
Call the local workload with a typed RPC request.
Convenience wrapper around app_context().call(&Dest::Local, request).
Use this from app-side code to invoke the local guest workload.
Sourcepub async fn call_remote<R: RpcRequest>(
&self,
target: ActrId,
request: R,
) -> ActorResult<R::Response>
pub async fn call_remote<R: RpcRequest>( &self, target: ActrId, request: R, ) -> ActorResult<R::Response>
Call a remote actor directly with a typed RPC request.
Convenience wrapper around app_context().call(&Dest::Actor(target), request).
Use this when the client has no local guest workload and calls the remote actor directly.
Sourcepub async fn discover_route_candidates(
&self,
target_type: &ActrType,
count: usize,
) -> ActorResult<Vec<ActrId>>
pub async fn discover_route_candidates( &self, target_type: &ActrType, count: usize, ) -> ActorResult<Vec<ActrId>>
Discover route candidates for the given actor type.
Returns up to count actor IDs registered under target_type.
Convenience wrapper for app-side discovery without holding a RuntimeContext.
Note: The signaling protocol currently returns one candidate per request.
This method will make up to count requests to collect multiple unique candidates.
Sourcepub async fn app_context(&self) -> RuntimeContext
pub async fn app_context(&self) -> RuntimeContext
Create an application-side runtime context bound to this running actor.
Sourcepub fn shutdown(&self)
pub fn shutdown(&self)
Trigger Actor shutdown
This signals the Actor to stop, but does not wait for completion.
Use wait_for_shutdown() to wait for cleanup to finish.
Sourcepub async fn wait_for_shutdown(&self)
pub async fn wait_for_shutdown(&self)
Wait for Actor to fully shutdown
This waits for the shutdown signal to be triggered.
All background tasks will be aborted when the last ActrRef is dropped.
Sourcepub fn is_shutting_down(&self) -> bool
pub fn is_shutting_down(&self) -> bool
Check if Actor is shutting down
Sourcepub async fn wait_for_ctrl_c_and_shutdown(self) -> ActorResult<()>
pub async fn wait_for_ctrl_c_and_shutdown(self) -> ActorResult<()>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ActrRef
impl !UnwindSafe for ActrRef
impl Freeze for ActrRef
impl Send for ActrRef
impl Sync for ActrRef
impl Unpin for ActrRef
impl UnsafeUnpin for ActrRef
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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