pub struct Addr<T: ?Sized + 'static> { /* private fields */ }
Expand description
A strong reference to a spawned actor. Actors can be spawned using Addr::new
.
Methods can be called on the actor after it has been spawned using the
send!(...)
and call!(...)
macros.
Can be converted to the address of a trait-object using the upcast!(...)
macro.
Implementations§
Trait Implementations§
Source§impl<T: Actor + ?Sized> AddrLike for Addr<T>
impl<T: Actor + ?Sized> AddrLike for Addr<T>
Source§fn send_fut(&self, fut: impl Future<Output = ()> + Send + 'static)
fn send_fut(&self, fut: impl Future<Output = ()> + Send + 'static)
Spawn a future onto the actor which does not return a value.
Source§fn call_fut<R: Send + 'static>(
&self,
fut: impl Future<Output = Produces<R>> + Send + 'static,
) -> Produces<R> ⓘ
fn call_fut<R: Send + 'static>( &self, fut: impl Future<Output = Produces<R>> + Send + 'static, ) -> Produces<R> ⓘ
Spawn a future onto the actor and provide the means to get back
the result. The future will be cancelled if the receiver is
dropped before it has completed.
Source§fn send_fut_with<F: Future<Output = ()> + Send + 'static>(
&self,
f: impl FnOnce(Self) -> F,
)
fn send_fut_with<F: Future<Output = ()> + Send + 'static>( &self, f: impl FnOnce(Self) -> F, )
Equivalent to
send_fut
but provides access to the actor’s address.Source§fn call_fut_with<R: Send + 'static, F: Future<Output = Produces<R>> + Send + 'static>(
&self,
f: impl FnOnce(Self) -> F,
) -> Produces<R> ⓘ
fn call_fut_with<R: Send + 'static, F: Future<Output = Produces<R>> + Send + 'static>( &self, f: impl FnOnce(Self) -> F, ) -> Produces<R> ⓘ
Equivalent to
call_fut
but provides access to the actor’s address.Source§fn termination(&self) -> Termination ⓘ
fn termination(&self) -> Termination ⓘ
Returns a future which resolves when the actor terminates. If the
actor has already terminated, or if this address is detached, the
future will resolve immediately.
Source§impl<T: ?Sized> Ord for Addr<T>
impl<T: ?Sized> Ord for Addr<T>
Source§impl<T: ?Sized, U: ?Sized> PartialOrd<Addr<U>> for Addr<T>
impl<T: ?Sized, U: ?Sized> PartialOrd<Addr<U>> for Addr<T>
Source§impl<T: ?Sized, U: ?Sized> PartialOrd<Addr<U>> for WeakAddr<T>
impl<T: ?Sized, U: ?Sized> PartialOrd<Addr<U>> for WeakAddr<T>
Source§impl<T: ?Sized, U: ?Sized> PartialOrd<WeakAddr<U>> for Addr<T>
impl<T: ?Sized, U: ?Sized> PartialOrd<WeakAddr<U>> for Addr<T>
impl<T: ?Sized> Eq for Addr<T>
Auto Trait Implementations§
impl<T> Freeze for Addr<T>where
T: ?Sized,
impl<T> !RefUnwindSafe for Addr<T>
impl<T> Send for Addr<T>where
T: ?Sized,
impl<T> Sync for Addr<T>where
T: ?Sized,
impl<T> Unpin for Addr<T>where
T: ?Sized,
impl<T> !UnwindSafe for Addr<T>
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