[][src]Trait riker::actor::Actor

pub trait Actor: Send + 'static {
    type Msg: Message;
    fn recv(&mut self, ctx: &Context<Self::Msg>, msg: Self::Msg, sender: Sender);

    fn pre_start(&mut self, ctx: &Context<Self::Msg>) { ... }
fn post_start(&mut self, ctx: &Context<Self::Msg>) { ... }
fn post_stop(&mut self) { ... }
fn supervisor_strategy(&self) -> Strategy { ... }
fn sys_recv(
        &mut self,
        ctx: &Context<Self::Msg>,
        msg: SystemMsg,
        sender: Sender
    ) { ... } }

Associated Types

type Msg: Message

Loading content...

Required methods

fn recv(&mut self, ctx: &Context<Self::Msg>, msg: Self::Msg, sender: Sender)

Invoked when an actor receives a message

It is guaranteed that only one message in the actor's mailbox is processed at any one time, including recv and sys_recv.

Loading content...

Provided methods

fn pre_start(&mut self, ctx: &Context<Self::Msg>)

Invoked when an actor is being started by the system.

Any initialization inherent to the actor's role should be performed here.

Panics in pre_start do not invoke the supervision strategy and the actor will be terminated.

fn post_start(&mut self, ctx: &Context<Self::Msg>)

Invoked after an actor has started.

Any post initialization can be performed here, such as writing to a log file, emmitting metrics.

Panics in post_start follow the supervision strategy.

fn post_stop(&mut self)

Invoked after an actor has been stopped.

fn supervisor_strategy(&self) -> Strategy

Return a supervisor strategy that will be used when handling failed child actors.

fn sys_recv(&mut self, ctx: &Context<Self::Msg>, msg: SystemMsg, sender: Sender)

Invoked when an actor receives a system message

It is guaranteed that only one message in the actor's mailbox is processed at any one time, including recv and sys_recv.

Loading content...

Implementations on Foreign Types

impl<A: Actor + ?Sized> Actor for Box<A>[src]

type Msg = A::Msg

Loading content...

Implementors

impl Actor for EventsChannel[src]

type Msg = ChannelMsg<SystemEvent>

impl<Msg> Actor for Channel<Msg> where
    Msg: Message
[src]

type Msg = ChannelMsg<Msg>

Loading content...