You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use std::time::Duration;
use riker::actors::*;
struct MyActor;
// implement the Actor trait
impl Actor for MyActor {
type Msg = String;
fn recv(&mut self,
_ctx: &Context<String>,
msg: String,
_sender: Sender) {
println!("Received: {}", msg);
}
}
// start the system and create an actor
fn main() {
let sys = ActorSystem::new().unwrap();
let my_actor = sys.actor_of::<MyActor>("my-actor").unwrap();
my_actor.tell("Hello my actor!".to_string(), None);
// force main to wait before exiting program
std::thread::sleep(Duration::from_millis(500));
}
does not compile, because:
error[E0277]: the trait bound `MyActor: Default` is not satisfied
--> src/main.rs:23:24
|
23 | let my_actor = sys.actor_of::<MyActor>("my-actor").unwrap();
| ^^^^^^^^ the trait `Default` is not implemented for `MyActor`
|
= note: required because of the requirements on the impl of `ActorFactory` for `MyActor`
This is on riker = "0.4", with cargo 1.50.0 (f04e7fab7 2021-02-04) and rustc 1.50.0 (cb75ad5db 2021-02-10).
The text was updated successfully, but these errors were encountered:
Hello,
the example here (found on https://riker.rs/actors/):
does not compile, because:
This is on
riker = "0.4"
, withcargo 1.50.0 (f04e7fab7 2021-02-04)
andrustc 1.50.0 (cb75ad5db 2021-02-10)
.The text was updated successfully, but these errors were encountered: