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§
fn on_spawn( &self, path: &ActorPath, parent: Option<&ActorPath>, actor_type: &'static str, )
fn on_stop(&self, path: &ActorPath)
Provided Methods§
Sourcefn on_mailbox_depth(&self, _path: &ActorPath, _depth: u64)
fn on_mailbox_depth(&self, _path: &ActorPath, _depth: u64)
Called whenever the mailbox depth is sampled (optional).