use
{
thespis :: { * } ,
thespis_impl :: { * } ,
async_executors :: { AsyncStd } ,
std :: { error::Error } ,
};
#[ derive( Actor ) ]
struct MyActor;
struct Ping;
impl Message for Ping
{
type Return = &'static str;
}
impl Handler< Ping > for MyActor
{
#[async_fn] fn handle( &mut self, _msg: Ping ) -> &'static str
{
"pong"
}
}
#[async_std::main]
async fn main() -> Result< (), Box<dyn Error> >
{
let mut addr = Addr::builder( "basic" ).spawn( MyActor, &AsyncStd )?;
let result = addr.call( Ping ).await?;
assert_eq!( "pong", result );
dbg!( result );
Ok(())
}