pub struct Address<C = dyn AnyChannel>where
C: DynChannel + ?Sized,{ /* private fields */ }Expand description
An address is a reference to the actor, used to send messages.
Addresses can be of two forms:
Address<Channel<M>>: This is the default form, which can be used to send messages of typeM. It can be transformed into anAddressusing Address::into_dyn.Address: This form is a dynamic address, which can do everything a normal address can do, except for sending messages. It can be transformed back into anAddress<Channel<M>>using Address::downcast::.
An address can be awaited which returns once the actor exits.
Implementations§
Source§impl<C> Address<C>where
C: DynChannel + ?Sized,
impl<C> Address<C>where
C: DynChannel + ?Sized,
Sourcepub fn downcast<M: Send + 'static>(self) -> Result<Address<Channel<M>>, Self>where
C: AnyChannel,
pub fn downcast<M: Send + 'static>(self) -> Result<Address<Channel<M>>, Self>where
C: AnyChannel,
Attempt to the downcast the Address into an Address<Channel<M>>.
Sourcepub fn process_count(&self) -> usize
pub fn process_count(&self) -> usize
Get the amount of processes.
Sourcepub fn address_count(&self) -> usize
pub fn address_count(&self) -> usize
pub fn is_bounded(&self) -> bool
Sourcepub fn has_exited(&self) -> bool
pub fn has_exited(&self) -> bool
Whether all processes have exited.
Source§impl<M> Address<Channel<M>>
impl<M> Address<Channel<M>>
Sourcepub fn into_dyn(self) -> Address ⓘwhere
M: Send + 'static,
pub fn into_dyn(self) -> Address ⓘwhere
M: Send + 'static,
Convert the Address<Channel<M>> into an Address.
Sourcepub fn try_send(&self, msg: M) -> Result<(), TrySendError<M>>
pub fn try_send(&self, msg: M) -> Result<(), TrySendError<M>>
Attempt to send a message to the actor.
- In the case of an
unboundedChannel, when BackPressure returns a timeout this fails. - In the case of a
boundedChannel, when it is full this fails.
For bounded channels, this method is the same as send_now.
Sourcepub fn send_now(&self, msg: M) -> Result<(), TrySendError<M>>
pub fn send_now(&self, msg: M) -> Result<(), TrySendError<M>>
Attempt to send a message to the actor.
- In the case of an
unboundedChannel, any BackPressure is ignored. - In the case of a
boundedChannel, when it is full this fails.
For bounded channels, this method is the same as try_send.
Trait Implementations§
impl<C: DynChannel + ?Sized> Unpin for Address<C>
Auto Trait Implementations§
impl<C> Freeze for Address<C>where
C: ?Sized,
impl<C> RefUnwindSafe for Address<C>where
C: RefUnwindSafe + ?Sized,
impl<C> Send for Address<C>
impl<C> Sync for Address<C>
impl<C> UnwindSafe for Address<C>where
C: RefUnwindSafe + ?Sized,
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<T> FutureExt for T
impl<T> FutureExt for T
Source§fn map<U, F>(self, f: F) -> Map<Self, F>
fn map<U, F>(self, f: F) -> Map<Self, F>
Map this future’s output to a different type, returning a new future of
the resulting type. Read more
Source§fn map_into<U>(self) -> MapInto<Self, U>
fn map_into<U>(self) -> MapInto<Self, U>
Map this future’s output to a different type, returning a new future of
the resulting type. Read more
Source§fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
Chain on a computation for when a future finished, passing the result of
the future to the provided closure
f. Read moreSource§fn left_future<B>(self) -> Either<Self, B>
fn left_future<B>(self) -> Either<Self, B>
Source§fn right_future<A>(self) -> Either<A, Self>
fn right_future<A>(self) -> Either<A, Self>
Source§fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
Convert this future into a single element stream. Read more
Source§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Flatten the execution of this future when the output of this
future is itself another future. Read more
Source§fn flatten_stream(self) -> FlattenStream<Self>
fn flatten_stream(self) -> FlattenStream<Self>
Flatten the execution of this future when the successful result of this
future is a stream. Read more
Source§fn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where
Self: Sized,
Fuse a future such that
poll will never again be called once it has
completed. This method can be used to turn any Future into a
FusedFuture. Read moreSource§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
Do something with the output of a future before passing it on. Read more
Source§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
Catches unwinding panics while polling the future. Read more
Create a cloneable handle to this future where all handles will resolve
to the same result. Read more
Source§fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)where
Self: Sized,
fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)where
Self: Sized,
Turn this future into a future that yields
() on completion and sends
its output to another future on a separate task. Read moreSource§fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
Wrap the future in a Box, pinning it. Read more
Source§fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
Wrap the future in a Box, pinning it. Read more
Source§fn unit_error(self) -> UnitError<Self>where
Self: Sized,
fn unit_error(self) -> UnitError<Self>where
Self: Sized,
Turns a
Future<Output = T> into a
TryFuture<Ok = T, Error = ()>.Source§fn never_error(self) -> NeverError<Self>where
Self: Sized,
fn never_error(self) -> NeverError<Self>where
Self: Sized,
Turns a
Future<Output = T> into a
TryFuture<Ok = T, Error = Never>.Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more