Trait ActorRef

Source
pub trait ActorRef<MsgT>:
    DynClone
    + Send
    + Debug
where MsgT: ActorMsg + 'static,
{ // Required methods fn send(&mut self, message: MsgT, delay: Option<Duration>); fn set_handler(&mut self, handler: DynMsgHandler<MsgT>); fn spawn_async_send( &mut self, f: impl Future<Output = MsgT> + Send + 'static, delay: Option<Duration>, ); fn spawn_thread_blocking_send( &mut self, f: impl FnOnce() -> MsgT + Send + 'static, delay: Option<Duration>, ); }
Expand description

An ActorRef can asynchronously send messages to the underlying actor, optionally with a delay, change the actor handler, spawn an async self-send, spawn a thread-blocking self-send and it can be cloned. Actor implementations can use ActorRefs to send messages to themselves and to other actors.

Required Methods§

Source

fn send(&mut self, message: MsgT, delay: Option<Duration>)

Source

fn set_handler(&mut self, handler: DynMsgHandler<MsgT>)

Source

fn spawn_async_send( &mut self, f: impl Future<Output = MsgT> + Send + 'static, delay: Option<Duration>, )

Source

fn spawn_thread_blocking_send( &mut self, f: impl FnOnce() -> MsgT + Send + 'static, delay: Option<Duration>, )

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<MsgT> ActorRef<MsgT> for DynActorRefWrapped<MsgT>
where MsgT: ActorMsg,

Source§

impl<MsgT> ActorRef<MsgT> for dyn ActorRef<MsgT>
where MsgT: ActorMsg + 'static,