async fn pong(ctx: ActorContext<Ping>, ping: Ping) -> Result<(), ActorRefGone<Pong>> {
    // should not really use blocking operations inside an actor
    println!("{} received a ping", ctx.name());
    ping.reply.tell(Pong {
        count: ping.count,
        reply: ctx.this(),
    })
}
/// pong actor: receives pings and responds with pongs
/// We need access to the name and ref of the actor, so we require ActorContext as a parameter
/// Returning a result inidicates the error condition when the actor will stop
/// Otherwise, returning () keeps the actor alive (could also use `Behaviors::Same`)
pong actor: receives pings and responds with pongs
We need access to the name and ref of the actor, so we require ActorContext as a parameter
Returning a result inidicates the error condition when the actor will stop
Otherwise, returning () keeps the actor alive (could also use `Behaviors::Same`)
pong actor : receives pings and responds with pongs We need access to the name and ref of the actor so we require ActorContext as a parameter Returning a result inidicates the error condition when the actor will stop Otherwise returning () keeps the actor alive ( could also use ` Behaviors :: Same ` )
async fn pong(ctx: ActorContext<Ping>, ping: Ping) -> Result<(), ActorRefGone<Pong>> {
    // should not really use blocking operations inside an actor
    println!("{} received a ping", ctx.name());
    ping.reply.tell(Pong {
        count: ping.count,
        reply: ctx.this(),
    })
}
async fn pong ( ctx : ActorContext < Ping > , ping : Ping ) -> Result < ( ) , ActorRefGone < Pong > > { // should not really use blocking operations inside an actor println ! ( " " ctx name ( ) ) ; ping . reply . tell ( Pong { count : ping . count , reply : ctx . this ( ) , } ) }
pong actor: receives pings and responds with pongs
We need access to the name and ref of the actor, so we require ActorContext as a parameter
Returning a result inidicates the error condition when the actor will stop
Otherwise, returning () keeps the actor alive (could also use `Behaviors::Same`)
pong actor : receives pings and responds with pongs We need access to the name and ref of the actor so we require ActorContext as a parameter Returning a result inidicates the error condition when the actor will stop Otherwise returning () keeps the actor alive ( could also use ` Behaviors :: Same ` )
ctx
ActorContext<Ping>
ping
Ping
ctx
ActorContext<Ping>
ping
Ping