pub struct Client { /* private fields */ }Expand description
A scoped caller context.
Dropping the last clone of a client closes its mailbox. Messages already accepted into port receivers remain available; later deliveries to the client’s ports fail as ordinary closed-mailbox deliveries.
Implementations§
Source§impl Client
impl Client
Sourcepub fn open_port<M: Message>(&self) -> (PortHandle<M>, PortReceiver<M>)
pub fn open_port<M: Message>(&self) -> (PortHandle<M>, PortReceiver<M>)
Open a new port that accepts M-typed messages.
Sourcepub fn open_once_port<M: Message>(
&self,
) -> (OncePortHandle<M>, OncePortReceiver<M>)
pub fn open_once_port<M: Message>( &self, ) -> (OncePortHandle<M>, OncePortReceiver<M>)
Open a new one-shot port that accepts an M-typed message.
Sourcepub fn bind_handler_port<M: RemoteMessage>(
&self,
) -> (PortHandle<M>, PortReceiver<M>)
pub fn bind_handler_port<M: RemoteMessage>( &self, ) -> (PortHandle<M>, PortReceiver<M>)
Bind a handler port to this client.
Sourcepub fn bind<R: Binds<ClientActor>>(&self) -> ActorRef<R>
pub fn bind<R: Binds<ClientActor>>(&self) -> ActorRef<R>
Bind this client as an actor ref.
Sourcepub fn spawn<A: Actor>(&self, actor: A) -> ActorHandle<A>
pub fn spawn<A: Actor>(&self, actor: A) -> ActorHandle<A>
Spawn a child actor with a fresh uid labeled from the actor type.
Sourcepub fn spawn_with_label<A: Actor>(
&self,
label: &str,
actor: A,
) -> ActorHandle<A>
pub fn spawn_with_label<A: Actor>( &self, label: &str, actor: A, ) -> ActorHandle<A>
Spawn a child actor with a fresh uid carrying a display label.
Sourcepub fn spawn_with_uid<A: Actor>(
&self,
uid: Uid,
actor: A,
) -> Result<ActorHandle<A>>
pub fn spawn_with_uid<A: Actor>( &self, uid: Uid, actor: A, ) -> Result<ActorHandle<A>>
Spawn a child actor using an explicit uid.
Sourcepub async fn gspawn(
&self,
actor_type: &str,
params: Data,
) -> Result<AnyActorHandle>
pub async fn gspawn( &self, actor_type: &str, params: Data, ) -> Result<AnyActorHandle>
Spawn a registered actor as this client’s child.
Sourcepub async fn gspawn_uid(
&self,
actor_type: &str,
uid: Uid,
params: Data,
) -> Result<AnyActorHandle>
pub async fn gspawn_uid( &self, actor_type: &str, uid: Uid, params: Data, ) -> Result<AnyActorHandle>
Spawn a registered actor as this client’s child using an explicit uid.
Sourcepub fn status(&self) -> Receiver<ActorStatus>
pub fn status(&self) -> Receiver<ActorStatus>
The client’s lifecycle status.
Trait Implementations§
Source§impl Actor for &Client
impl Actor for &Client
Source§type A = ClientActor
type A = ClientActor
The type of actor associated with this context.
Source§fn instance(&self) -> &Instance<ClientActor>
fn instance(&self) -> &Instance<ClientActor>
The instance associated with this context.
Source§fn spawn<C: Actor>(&self, actor: C) -> ActorHandle<C>where
Self: Sized,
fn spawn<C: Actor>(&self, actor: C) -> ActorHandle<C>where
Self: Sized,
Spawn a child actor under this actor context.
Source§fn spawn_with_label<C: Actor>(&self, label: &str, actor: C) -> ActorHandle<C>where
Self: Sized,
fn spawn_with_label<C: Actor>(&self, label: &str, actor: C) -> ActorHandle<C>where
Self: Sized,
Spawn a child actor with a fresh uid carrying a display label.
Source§fn spawn_with_uid<C: Actor>(&self, uid: Uid, actor: C) -> Result<ActorHandle<C>>where
Self: Sized,
fn spawn_with_uid<C: Actor>(&self, uid: Uid, actor: C) -> Result<ActorHandle<C>>where
Self: Sized,
Spawn a child actor using an explicit uid.
Source§impl Actor for Client
impl Actor for Client
Source§type A = ClientActor
type A = ClientActor
The type of actor associated with this context.
Source§fn instance(&self) -> &Instance<ClientActor>
fn instance(&self) -> &Instance<ClientActor>
The instance associated with this context.
Source§fn spawn<C: Actor>(&self, actor: C) -> ActorHandle<C>where
Self: Sized,
fn spawn<C: Actor>(&self, actor: C) -> ActorHandle<C>where
Self: Sized,
Spawn a child actor under this actor context.
Source§fn spawn_with_label<C: Actor>(&self, label: &str, actor: C) -> ActorHandle<C>where
Self: Sized,
fn spawn_with_label<C: Actor>(&self, label: &str, actor: C) -> ActorHandle<C>where
Self: Sized,
Spawn a child actor with a fresh uid carrying a display label.
Source§fn spawn_with_uid<C: Actor>(&self, uid: Uid, actor: C) -> Result<ActorHandle<C>>where
Self: Sized,
fn spawn_with_uid<C: Actor>(&self, uid: Uid, actor: C) -> Result<ActorHandle<C>>where
Self: Sized,
Spawn a child actor using an explicit uid.
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl !UnwindSafe for Client
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,
§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].