pub async fn notify<IN>(&mut self, message: IN) -> Result<(), SendError>
    where
        A: Actor + Send + Notifiable<IN> + 'static,
        IN: Send + 'static,
    {
        let envelope: NotificationEnvelope<A, IN> = NotificationEnvelope::new(message);

        let message = Box::new(envelope) as Box<dyn EnvelopeProxy<A> + Send + 'static>;

        self.sender
            .send(Signal::Message(message))
            .await
            .map_err(|_| SendError::ReceiverDisconnected)?;

        Ok(())
    }
/// Sends a notification to the [`Actor`] without receiving any kind of response.
///
/// ## Examples
///
/// This example assumes that `messages` is used with `rt-tokio` feature enabled.
///
/// ```rust
/// # use messages::prelude::*;
///
/// struct Ping;
///
/// #[async_trait]
/// impl Actor for Ping {}
///
/// #[async_trait]
/// impl Notifiable<u8> for Ping {
///     async fn notify(&mut self, input: u8, context: &Context<Self>) {
///         println!("Received number {}", input);
///     }
/// }
///
/// #[tokio::main]
/// async fn main() {
///    let mut addr = Ping.spawn();
///    addr.notify(42).await.unwrap();
///    # addr.stop().await;
///    # addr.wait_for_stop().await;  
/// }
/// ```
///
/// ## Errors
///
/// Will return an error in case associated actor stopped working.
Sends a notification to the [`Actor`] without receiving any kind of response.
Sends a notification to the [ ` Actor ` ] without receiving any kind of response .
pub async fn notify<IN>(&mut self, message: IN) -> Result<(), SendError>
    where
        A: Actor + Send + Notifiable<IN> + 'static,
        IN: Send + 'static,
    {
        let envelope: NotificationEnvelope<A, IN> = NotificationEnvelope::new(message);
        let message = Box::new(envelope) as Box<dyn EnvelopeProxy<A> + Send + 'static>;
        self.sender
            .send(Signal::Message(message))
            .await
            .map_err(|_| SendError::ReceiverDisconnected)?;
        Ok(())
    }
pub async fn notify < IN > ( & mut self , message : IN ) -> Result < ( ) , SendError > where A : Actor + Send + Notifiable < IN > + ' static , IN : Send + ' static , { let envelope : NotificationEnvelope < A , IN > = NotificationEnvelope :: new ( message ) ; let message = Box :: new ( envelope ) as Box < dyn EnvelopeProxy < A > + Send + ' static > ; self . sender . send ( Signal :: Message ( message ) ) . await . map_err ( | _ | SendError :: ReceiverDisconnected ) ? ; Ok ( ( ) ) }
Sends a notification to the [`Actor`] without receiving any kind of response.
Sends a notification to the [ ` Actor ` ] without receiving any kind of response .
&mut self
message
IN
&mut self
message
IN
examples
This example assumes that `messages` is used with `rt-tokio` feature enabled.


This example assumes that ` messages ` is used with ` rt - tokio ` feature enabled .
use messages::prelude::*;
None
[async_trait]
impl Actor for Ping {}
impl Actor for Ping {}
[async_trait]
impl Notifiable for Ping {
async fn notify(&mut self, input: u8, context: &Context) {
println!("Received number {}", input);
}
}
impl Notifiable for Ping { async fn notify ( &mut self input : u8 context : &Context ) { println! ( " Received number {} " input ) ; } }
[tokio::main]
async fn main() {
let mut addr = Ping.spawn();
addr.notify(42).await.unwrap();
addr.stop().await;
addr.wait_for_stop().await;
}
```
async fn main () { let mut addr = Ping . spawn () ; addr . notify ( 42 ) . await . unwrap () ; addr . stop () . await ; addr . wait_for_stop () . await ; } ` ` `
errors
Will return an error in case associated actor stopped working.
Will return an error in case associated actor stopped working .