pub struct ActorSystem<E: SystemEvent> { /* private fields */ }

Implementations§

source§

impl<E: SystemEvent> ActorSystem<E>

source

pub fn name(&self) -> &str

The name given to this actor system

source

pub fn publish(&self, event: E)

Publish an event on the actor system’s event bus. These events can be received by other actors in the same actor system.

source

pub fn events(&self) -> EventReceiver<E>

Subscribe to events of this actor system.

source

pub async fn get_actor<A: Actor<E>>( &self, path: &ActorPath ) -> Option<ActorRef<E, A>>

Retrieves an actor running in this actor system. If actor does not exist, a None is returned instead.

source

pub async fn create_actor<A: Actor<E>>( &self, name: &str, actor: A ) -> Result<ActorRef<E, A>, ActorError>

Launches a new top level actor on this actor system at the ‘/user’ actor path. If another actor with the same name already exists, an Err(ActorError::Exists(ActorPath)) is returned instead.

source

pub async fn get_or_create_actor<A, F>( &self, name: &str, actor_fn: F ) -> Result<ActorRef<E, A>, ActorError>
where A: Actor<E>, F: FnOnce() -> A,

Retrieve or create a new actor on this actor system if it does not exist yet.

source

pub async fn stop_actor(&self, path: &ActorPath)

Stops the actor on this actor system. All its children will also be stopped.

source

pub fn new(name: &str, bus: EventBus<E>) -> Self

Creats a new actor system on which you can create actors.

Trait Implementations§

source§

impl<E: Clone + SystemEvent> Clone for ActorSystem<E>

source§

fn clone(&self) -> ActorSystem<E>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<E: SystemEvent> Debug for ActorSystem<E>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<E> !RefUnwindSafe for ActorSystem<E>

§

impl<E> Send for ActorSystem<E>

§

impl<E> Sync for ActorSystem<E>

§

impl<E> Unpin for ActorSystem<E>

§

impl<E> !UnwindSafe for ActorSystem<E>

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> 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,

§

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>,

§

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>,

§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V