pub fn send<M>(&self, message: M) -> ReplyFuture<M>
    where
        M: Message,
        A: Handler<M> + Send + 'static,
    {
        log::trace!(
            "Sending message {:?} to agent {:?}",
            type_name::<M>(),
            type_name::<A>()
        );
        let (cx, reply_fut) = Context::new(self);
        let tx = self.tx.clone();
        tokio::spawn(async move {
            let send_fut = tx.send(Box::new(move |agent: &mut A| {
                agent.handle(message, cx);
            }));
            if send_fut.await.is_err() {
                panic!("tried to send message to stopped agent");
            }
        });
        reply_fut
    }
/// Sends a message to the agent.
Sends a message to the agent.
Sends a message to the agent .
pub fn send<M>(&self, message: M) -> ReplyFuture<M>
    where
        M: Message,
        A: Handler<M> + Send + 'static,
    {
        log::trace!(
            "Sending message {:?} to agent {:?}",
            type_name::<M>(),
            type_name::<A>()
        );
        let (cx, reply_fut) = Context::new(self);
        let tx = self.tx.clone();
        tokio::spawn(async move {
            let send_fut = tx.send(Box::new(move |agent: &mut A| {
                agent.handle(message, cx);
            }));
            if send_fut.await.is_err() {
                panic!("tried to send message to stopped agent");
            }
        });
        reply_fut
    }
pub fn send < M > ( & self , message : M ) -> ReplyFuture < M > where M : Message , A : Handler < M > + Send + ' static , { log :: trace ! ( " " type_name M ( ) type_name A ( ) ) ; let ( cx , reply_fut ) = Context :: new ( self ) ; let tx = self . tx . clone ( ) ; tokio :: spawn ( async move { let send_fut = tx . send ( Box :: new ( move | agent : & mut A | { agent . handle ( message , cx ) ; } ) ) ; if send_fut . await . is_err ( ) { panic ! ( " " ) ; } } ) ; reply_fut }
Sends a message to the agent.
Sends a message to the agent .
&self
message
M
&self
message
M