Skip to main content

SpawnObserver

Trait SpawnObserver 

Source
pub trait SpawnObserver:
    Send
    + Sync
    + 'static {
    // Required methods
    fn on_spawn(
        &self,
        path: &ActorPath,
        parent: Option<&ActorPath>,
        actor_type: &'static str,
    );
    fn on_stop(&self, path: &ActorPath);

    // Provided method
    fn on_mailbox_depth(&self, _path: &ActorPath, _depth: u64) { ... }
}
Expand description

Implementors are notified whenever actors are spawned or stopped. Methods are called on the actor’s task, so they should be cheap and non-blocking.

Required Methods§

Source

fn on_spawn( &self, path: &ActorPath, parent: Option<&ActorPath>, actor_type: &'static str, )

Source

fn on_stop(&self, path: &ActorPath)

Provided Methods§

Source

fn on_mailbox_depth(&self, _path: &ActorPath, _depth: u64)

Called whenever the mailbox depth is sampled (optional).

Implementors§