Struct tiny_tokio_actor::ActorContext [−][src]
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: ActorPathsystem: ActorSystem<E>Implementations
pub 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.
Retrieve a child actor running under this actor.
pub async fn get_or_create_child<A, F>(
&self,
name: &str,
actor_fn: F
) -> Result<ActorRef<E, A>, ActorError> where
A: Actor<E>,
F: FnOnce() -> A,
pub async fn get_or_create_child<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 child under this actor if it does not exist yet
Stops the child actor
