pub struct Supervisor<B, C>{ /* private fields */ }Implementations§
Source§impl<B, C> Supervisor<B, C>
impl<B, C> Supervisor<B, C>
Sourcepub fn new(
inner: B,
nonces: fn(usize) -> <<B as Behavior>::Addr as Address>::Nonce,
count: usize,
build: fn(usize) -> C,
strategy: Strategy,
policy: RestartPolicy,
max_restarts: u32,
window: Duration,
) -> Supervisor<B, C>
pub fn new( inner: B, nonces: fn(usize) -> <<B as Behavior>::Addr as Address>::Nonce, count: usize, build: fn(usize) -> C, strategy: Strategy, policy: RestartPolicy, max_restarts: u32, window: Duration, ) -> Supervisor<B, C>
Construct the concrete supervisor behavior hidden by Compose.
§Panics
Panics when configured child nonces are not unique. Such a topology would violate creator-local child routing and creation freshness before the behavior could return an initialization result.
pub fn with_strategy(self, strategy: Strategy) -> Supervisor<B, C>
pub fn with_policy(self, policy: RestartPolicy) -> Supervisor<B, C>
pub fn with_budget(self, max: u32, window: Duration) -> Supervisor<B, C>
Sourcepub fn with_failure_reaction(
self,
reaction: fn(&mut B, &SupervisionFailure<<B as Behavior>::Addr>) -> Result<Step<Never, Exit<<B as Behavior>::Addr>>, <B as Behavior>::Error>,
) -> Supervisor<B, C>
pub fn with_failure_reaction( self, reaction: fn(&mut B, &SupervisionFailure<<B as Behavior>::Addr>) -> Result<Step<Never, Exit<<B as Behavior>::Addr>>, <B as Behavior>::Error>, ) -> Supervisor<B, C>
Replace the pure reaction used for typed supervision failures.
Sourcepub fn is_alive(&self, nonce: <<B as Behavior>::Addr as Address>::Nonce) -> bool
pub fn is_alive(&self, nonce: <<B as Behavior>::Addr as Address>::Nonce) -> bool
Report whether a known supervised proxy is alive.
§Panics
Panics when nonce is not part of this supervisor topology.
pub fn child_count(&self) -> usize
pub fn restarts_in_window(&self) -> usize
Trait Implementations§
Source§impl<B, C, A, Ph, Sends> Behavior for Supervisor<B, C>where
Sends: SendAlgebra,
B: Behavior<Addr = A, Ph = Ph, Sends = Sends, Birth = Births<C>>,
<B as Behavior>::Event: ChildEvent + CreationEvent + WorkerCreationEvent,
<A as Address>::Nonce: From<u64>,
C: Behavior<Ph = Never, Addr = <B as Behavior>::Addr>,
A: Address,
impl<B, C, A, Ph, Sends> Behavior for Supervisor<B, C>where
Sends: SendAlgebra,
B: Behavior<Addr = A, Ph = Ph, Sends = Sends, Birth = Births<C>>,
<B as Behavior>::Event: ChildEvent + CreationEvent + WorkerCreationEvent,
<A as Address>::Nonce: From<u64>,
C: Behavior<Ph = Never, Addr = <B as Behavior>::Addr>,
A: Address,
type Addr = A
type Msg = <B as Behavior>::Msg
type Event = SupervisionEvent<<B as Behavior>::Event>
type Sends = SupervisorSends<A, Sends, C>
type Ph = Ph
type Error = <B as Behavior>::Error
type Birth = Births<Proxy<C>>
Source§fn init(
&mut self,
) -> Result<Actions<<B as Behavior>::Addr, <B as Behavior>::Ph, SupervisorSends<<B as Behavior>::Addr, <B as Behavior>::Sends, C>, Births<Proxy<C>>>, <B as Behavior>::Error>
fn init( &mut self, ) -> Result<Actions<<B as Behavior>::Addr, <B as Behavior>::Ph, SupervisorSends<<B as Behavior>::Addr, <B as Behavior>::Sends, C>, Births<Proxy<C>>>, <B as Behavior>::Error>
Produce initialization actions before the first event is accepted. Read more
Source§fn transition(
&mut self,
event: <Supervisor<B, C> as Behavior>::Event,
) -> Result<Actions<<B as Behavior>::Addr, <B as Behavior>::Ph, SupervisorSends<<B as Behavior>::Addr, <B as Behavior>::Sends, C>, Births<Proxy<C>>>, <B as Behavior>::Error>
fn transition( &mut self, event: <Supervisor<B, C> as Behavior>::Event, ) -> Result<Actions<<B as Behavior>::Addr, <B as Behavior>::Ph, SupervisorSends<<B as Behavior>::Addr, <B as Behavior>::Sends, C>, Births<Proxy<C>>>, <B as Behavior>::Error>
Fold exactly one event into explicit actions and the next behavior. Read more
Auto Trait Implementations§
impl<B, C> Freeze for Supervisor<B, C>where
B: Freeze,
impl<B, C> RefUnwindSafe for Supervisor<B, C>
impl<B, C> Send for Supervisor<B, C>
impl<B, C> Sync for Supervisor<B, C>
impl<B, C> Unpin for Supervisor<B, C>
impl<B, C> UnsafeUnpin for Supervisor<B, C>where
B: UnsafeUnpin,
impl<B, C> UnwindSafe for Supervisor<B, C>
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