Struct tiny_tokio_actor::ActorContext
source · pub struct ActorContext<E: SystemEvent> {
pub path: ActorPath,
pub system: ActorSystem<E>,
}
Expand description
The actor context gives a running actor access to its path, as well as the system that is running it.
Fields§
§path: ActorPath
§system: ActorSystem<E>
Implementations§
source§impl<E: SystemEvent> ActorContext<E>
impl<E: SystemEvent> ActorContext<E>
sourcepub async fn create_child<A: Actor<E>>(
&self,
name: &str,
actor: A
) -> Result<ActorRef<E, A>, ActorError>
pub async fn create_child<A: Actor<E>>( &self, name: &str, actor: A ) -> Result<ActorRef<E, A>, ActorError>
Create a child actor under this actor.
sourcepub async fn get_child<A: Actor<E>>(&self, name: &str) -> Option<ActorRef<E, A>>
pub async fn get_child<A: Actor<E>>(&self, name: &str) -> Option<ActorRef<E, A>>
Retrieve a child actor running under this actor.
sourcepub async fn get_or_create_child<A, F>(
&self,
name: &str,
actor_fn: F
) -> Result<ActorRef<E, A>, ActorError>
pub async fn get_or_create_child<A, F>( &self, name: &str, actor_fn: F ) -> Result<ActorRef<E, A>, ActorError>
Retrieve or create a new child under this actor if it does not exist yet
sourcepub async fn stop_child(&self, name: &str)
pub async fn stop_child(&self, name: &str)
Stops the child actor
Trait Implementations§
Auto Trait Implementations§
impl<E> !RefUnwindSafe for ActorContext<E>
impl<E> Send for ActorContext<E>
impl<E> Sync for ActorContext<E>
impl<E> Unpin for ActorContext<E>
impl<E> !UnwindSafe for ActorContext<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