Skip to content

How to use ret_* to send the stop reason to a parent actor? #36

Closed Answered by hardliner66
hardliner66 asked this question in Q&A
Discussion options

You must be logged in to vote

Nevermind, I figured it out.

use std::{
    io::Write,
    time::{Duration, Instant},
};

use mio::{Events, Poll};
use stakker::*;
use stakker_mio::MioPoll;

struct Animal {
    is_cat: bool,
    cat: ActorOwn<Cat>,
    dog: ActorOwn<Dog>,
}
impl Animal {
    fn init(cx: CX![Animal]) -> Option<Self> {
        let this = cx.this().clone();
        Some(Self {
            is_cat: true,
            cat: Self::make_cat(cx, this.clone()),
            dog: Self::make_dog(cx, this),
        })
    }

    fn make_cat(cx: CX![], parent: Actor<Self>) -> ActorOwn<Cat> {
        actor!(
            cx,
            Cat::init(parent.clone()),
            ret_some_to!([parent], child_stopped("cat") as (S…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by hardliner66
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@uazu
Comment options

@hardliner66
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants