Trait RuntimeActorExt

Source
pub trait RuntimeActorExt: Actor {
    // Provided methods
    fn spawn(self) -> Address<Self> { ... }
    fn create_and_spawn<F>(f: F) -> Address<Self>
       where F: FnOnce(&Context<Self>) -> Self + Send { ... }
}
Available on crate features runtime-tokio or runtime-async-std only.
Expand description

Extension trait for Actor providing more convenient interface when one of the runtime features is enabled.

Provided Methods§

Source

fn spawn(self) -> Address<Self>

Spawns an actor using supported runtime.

Returns an address of this actor.

Source

fn create_and_spawn<F>(f: F) -> Address<Self>
where F: FnOnce(&Context<Self>) -> Self + Send,

Same as Actor::create_and_run, but spawns the future instead of returning it.

Returns an address of this actor.

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.

Implementors§

Source§

impl<T> RuntimeActorExt for T
where T: Actor,