use stakker::*;
use std::time::Instant;
struct Cat;
impl Cat {
fn init(_: CX![]) -> Option<Self> {
Some(Self)
}
fn sound(&mut self, _: CX![]) {
println!("Miaow");
}
}
struct Dog;
impl Dog {
fn init(_: CX![]) -> Option<Self> {
Some(Self)
}
fn sound(&mut self, _: CX![]) {
println!("Woof");
}
}
pub fn call_and_drop(sound: Fwd<()>, _own: ActorOwnAnon) {
fwd!([sound]);
}
fn main() {
let mut stakker = Stakker::new(Instant::now());
let s = &mut stakker;
let cat = actor!(s, Cat::init(), ret_nop!());
call_and_drop(fwd_to!([cat], sound() as ()), cat.anon());
let dog = actor!(s, Dog::init(), ret_nop!());
call_and_drop(fwd_to!([dog], sound() as ()), dog.anon());
s.run(Instant::now(), false);
}