Struct ActorRef

Source
pub struct ActorRef { /* private fields */ }
Expand description

An ActorRef is the way used to interract with something that acts as an actor.

This can represent either an ACtor, a Future or Cthulhu (the original actor) whether distant or local.

It gives the Actor API, it can receive messages, be told to send messages, be asked something and give its ActorPath.

Implementations§

Source§

impl ActorRef

Source

pub fn new_distant(path: Arc<ActorPath>) -> ActorRef

Creates a new ActorRef to a distant actor, with the given ActorPath.

Source

pub fn with_cthulhu(cthulhu: Cthulhu) -> ActorRef

Creates a new ActorRef to Cthulhu, this should only be called once.

Source

pub fn with_cell(cell: ActorCell, path: Arc<ActorPath>) -> ActorRef

Creates a new ActorRef for a local Actor, with the given ActorCell.

Source

pub fn receive_system_message(&self, system_message: SystemMessage)

Receives a system message such as Start, Restart or a Failure(ActorRef), puts it in the system mailbox and schedules the actor if needed.

Source

pub fn receive(&self, message: InnerMessage, sender: ActorRef)

Receives a regular message and puts it in the mailbox and schedules the actor if needed.

Source

pub fn handle(&self)

Handles a messages by calling the receive method of the underlying actor.

Source

pub fn path(&self) -> Arc<ActorPath>

Gives a clone of the ActorPath.

Source

pub fn tell_to<MessageTo: Message>(&self, to: ActorRef, message: MessageTo)

Makes this ActorRef send a message to anther ActorRef.

Trait Implementations§

Source§

impl Clone for ActorRef

Source§

fn clone(&self) -> ActorRef

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Arguments for T
where T: Clone + Send + Sync + 'static,

Source§

impl<T> Message for T
where T: Clone + Send + Sync + 'static + Any,