[][src]Struct sealrs::actors::actor_cell::ActorCell

pub struct ActorCell {
    pub dispatcher: TSafe<dyn Dispatcher + Send>,
    pub mailbox: TSafe<dyn Mailbox + Send>,
    pub bid: usize,
    pub actor: TSafe<dyn Actor + Send>,
    pub path: TSafe<ActorPath>,
    pub system: TSafe<dyn AbstractActorSystem + Send>,
    pub suspended: bool,
    pub stopped: bool,
}

Fields

dispatcher: TSafe<dyn Dispatcher + Send>

Reference to the message dispatcher

mailbox: TSafe<dyn Mailbox + Send>

Actor mailbox

bid: usize

Executor asynchronous block id. Actually this value represents the thread id, on the actor messages will processed. See default_dispatcher for more info about actor's async mechanics.

actor: TSafe<dyn Actor + Send>

Object which extends the actor trait and contain application logic

path: TSafe<ActorPath>

Actor path object that represents the actor position in the actors hierarchy

system: TSafe<dyn AbstractActorSystem + Send>

Reference to the actor system

suspended: bool

Suspend flag. See the suspend method description for more details

stopped: bool

Stop flag. See the start method description for more details

Methods

impl ActorCell[src]

pub fn new(
    system: TSafe<dyn AbstractActorSystem + Send>,
    path: TSafe<ActorPath>,
    actor: TSafe<dyn Actor + Send>,
    bid: usize,
    dispatcher: TSafe<dyn Dispatcher + Send>,
    mailbox: TSafe<dyn Mailbox + Send>
) -> ActorCell
[src]

Create new actor cell. This is the internal constructor and should never be used in a user code.

pub fn start(&mut self, boxed_self: TSafe<ActorCell>)[src]

Starts the actor. Creates him context, obtain bid form the dispatcher, run preStart hook and permits message receiving through dropping the stopped flag.

pub fn stop(&mut self, boxed_self: TSafe<ActorCell>)[src]

Stops the actor. Prohibits receiving new messages and calls the postStop hook.

pub fn suspend(&mut self)[src]

Suspends the actor. Prohibits receiving new messages.

pub fn send(
    &mut self,
    boxed_self: &TSafe<ActorCell>,
    msg: Message,
    rself: Option<ActorRef>,
    to_ref: Box<dyn AbstractActorRef + Send>
)
[src]

Sends the message to the actor. Creates new envelope with the message and indicates to dispatcher to schedule execution of this envelope. Message sends to the actors may be done, only if flags suspended and stopped will be dropped. Otherwise, the message will be dropped to deadLetter.

pub fn force_send(
    &mut self,
    boxed_self: TSafe<ActorCell>,
    msg: Message,
    rself: Option<Box<dyn AbstractActorRef + Send>>,
    to_ref: Box<dyn AbstractActorRef + Send>
)
[src]

Performs action identical to the send method do, but with ignoring state of the stopping flags.

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]