Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Define an actor that handles messages and run it with the actix system.
use actix::{Actor, Context, Handler, Message};
struct MyActor;
impl Actor for MyActor {
type Context = Context<Self>;
}
struct Ping;
impl Message for Ping {
type Result = String;
}
impl Handler<Ping> for MyActor {
type Result = String;
fn handle(&mut self, _msg: Ping, _ctx: &mut Context<Self>) -> String {
"Pong".to_string()
}
}
fn main() {
let sys = actix::System::new();
sys.block_on(async {
let addr = MyActor.start();
let res = addr.send(Ping).await.unwrap();
println!("{}", res);
});
}
Upgrade
Version history
0.13.5latest on crates.io
Audit
Dependencies
No dependency data recorded yet.