Struct tiny_tokio_actor::ActorSystem
source · pub struct ActorSystem<E: SystemEvent> { /* private fields */ }
Implementations§
source§impl<E: SystemEvent> ActorSystem<E>
impl<E: SystemEvent> ActorSystem<E>
sourcepub fn publish(&self, event: E)
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.
sourcepub fn events(&self) -> EventReceiver<E>
pub fn events(&self) -> EventReceiver<E>
Subscribe to events of this actor system.
sourcepub async fn get_actor<A: Actor<E>>(
&self,
path: &ActorPath
) -> Option<ActorRef<E, A>>
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.
sourcepub async fn create_actor<A: Actor<E>>(
&self,
name: &str,
actor: A
) -> Result<ActorRef<E, A>, ActorError>
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.
sourcepub async fn get_or_create_actor<A, F>(
&self,
name: &str,
actor_fn: F
) -> Result<ActorRef<E, A>, ActorError>
pub async fn get_or_create_actor<A, F>( &self, name: &str, actor_fn: F ) -> Result<ActorRef<E, A>, ActorError>
Retrieve or create a new actor on this actor system if it does not exist yet.
sourcepub async fn stop_actor(&self, path: &ActorPath)
pub async fn stop_actor(&self, path: &ActorPath)
Stops the actor on this actor system. All its children will also be stopped.
Trait Implementations§
source§impl<E: Clone + SystemEvent> Clone for ActorSystem<E>
impl<E: Clone + SystemEvent> Clone for ActorSystem<E>
source§fn clone(&self) -> ActorSystem<E>
fn clone(&self) -> ActorSystem<E>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto 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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more