pub trait AddrLike:
Send
+ Sync
+ Clone
+ Debug
+ 'static
+ AsAddr<Addr = Self> {
type Actor: Actor + ?Sized;
// Required method
fn send_fut(&self, fut: impl Future<Output = ()> + Send + 'static);
// Provided methods
fn call_fut<R: Send + 'static>(
&self,
fut: impl Future<Output = Produces<R>> + Send + 'static,
) -> Produces<R> ⓘ { ... }
fn send_fut_with<F: Future<Output = ()> + Send + 'static>(
&self,
f: impl FnOnce(Self) -> F,
) { ... }
fn call_fut_with<R: Send + 'static, F: Future<Output = Produces<R>> + Send + 'static>(
&self,
f: impl FnOnce(Self) -> F,
) -> Produces<R> ⓘ { ... }
fn termination(&self) -> Termination ⓘ { ... }
}
Expand description
Trait provides methods for spawning futures onto an actor. Implemented by
Addr
and WeakAddr
alike.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.