pub struct SupervisorTree { /* private fields */ }Expand description
Hierarchical supervisor tree structure.
Implementations§
Source§impl SupervisorTree
impl SupervisorTree
Sourcepub fn new(root_strategy: SupervisionStrategy) -> Self
pub fn new(root_strategy: SupervisionStrategy) -> Self
Create a new supervisor tree with a root supervisor.
Sourcepub fn add_supervisor(
&mut self,
parent: ActorId,
strategy: SupervisionStrategy,
) -> Result<ActorId>
pub fn add_supervisor( &mut self, parent: ActorId, strategy: SupervisionStrategy, ) -> Result<ActorId>
Add a new supervisor under a parent.
Sourcepub fn start_child_under(
&mut self,
supervisor: ActorId,
spec: ChildSpec,
) -> Result<ActorId>
pub fn start_child_under( &mut self, supervisor: ActorId, spec: ChildSpec, ) -> Result<ActorId>
Start a child actor under a specific supervisor.
Sourcepub fn get_supervisor(&self, id: &ActorId) -> Option<&Supervisor>
pub fn get_supervisor(&self, id: &ActorId) -> Option<&Supervisor>
Get a supervisor by ID.
Sourcepub fn get_supervisor_mut(&mut self, id: &ActorId) -> Option<&mut Supervisor>
pub fn get_supervisor_mut(&mut self, id: &ActorId) -> Option<&mut Supervisor>
Get a supervisor by ID mutably.
Sourcepub async fn terminate_tree(&mut self, root_id: &ActorId) -> Result<()>
pub async fn terminate_tree(&mut self, root_id: &ActorId) -> Result<()>
Terminate a subtree starting from a given supervisor.
Sourcepub async fn handle_child_exit(
&mut self,
supervisor_id: ActorId,
child_name: &str,
reason: ExitReason,
) -> Result<()>
pub async fn handle_child_exit( &mut self, supervisor_id: ActorId, child_name: &str, reason: ExitReason, ) -> Result<()>
Handle a child exit in the appropriate supervisor.
Sourcepub fn tree_stats(&self) -> SupervisorTreeStats
pub fn tree_stats(&self) -> SupervisorTreeStats
Get statistics for the entire tree.
Sourcepub fn tree_depth(&self) -> usize
pub fn tree_depth(&self) -> usize
Get the depth of the tree.
Auto Trait Implementations§
impl Freeze for SupervisorTree
impl RefUnwindSafe for SupervisorTree
impl Send for SupervisorTree
impl Sync for SupervisorTree
impl Unpin for SupervisorTree
impl UnsafeUnpin for SupervisorTree
impl UnwindSafe for SupervisorTree
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