async fn ping_pong() {
    let system = ActorSystem::new();

    let pinger = system.spawn("ping", ping);
    let ponger = system.spawn("pong", pong);

    // The initial message to the pinger with 3 iterations
    let _ = pinger.tell(Pong {
        count: 3,
        reply: ponger,
    });

    // wait until the pinger has received the pong and has stopped
    pinger.wait_for_stop().await;
}
// a test scenario
// We can create actors from an actor system
a test scenario
We can create actors from an actor system
a test scenario We can create actors from an actor system
async fn ping_pong() {
    let system = ActorSystem::new();
    let pinger = system.spawn("ping", ping);
    let ponger = system.spawn("pong", pong);
    // The initial message to the pinger with 3 iterations
    let _ = pinger.tell(Pong {
        count: 3,
        reply: ponger,
    });
    // wait until the pinger has received the pong and has stopped
    pinger.wait_for_stop().await;
}
async fn ping_pong ( ) { let system = ActorSystem :: new ( ) ; let pinger = system . spawn ( " " , ping ) ; let ponger = system . spawn ( " " , pong ) ; // The initial message to the pinger with 3 iterations let _ = pinger . tell ( Pong { count : 3 , reply : ponger , } ) ; // wait until the pinger has received the pong and has stopped pinger . wait_for_stop ( ) . await ; }
a test scenario
We can create actors from an actor system
a test scenario We can create actors from an actor system