pub struct Supervising<B: Behavior, C: Behavior<Ph = Never, Addr = B::Addr>> { /* private fields */ }Implementations§
Source§impl<B, C> Supervising<B, C>
impl<B, C> Supervising<B, C>
Sourcepub fn new(
inner: B,
nonces: fn(usize) -> <B::Addr as Address>::Nonce,
count: usize,
build: fn(usize) -> C,
strategy: Strategy,
policy: RestartPolicy,
max_restarts: u32,
window: Duration,
) -> Self
pub fn new( inner: B, nonces: fn(usize) -> <B::Addr as Address>::Nonce, count: usize, build: fn(usize) -> C, strategy: Strategy, policy: RestartPolicy, max_restarts: u32, window: Duration, ) -> Self
Construct the concrete supervisor behavior hidden by Spec.
§Panics
Panics only if a fleet index cannot be represented by u64.
pub fn with_strategy(self, strategy: Strategy) -> Self
pub fn with_policy(self, policy: RestartPolicy) -> Self
pub fn with_budget(self, max: u32, window: Duration) -> Self
Sourcepub fn is_alive(&self, nonce: <B::Addr as Address>::Nonce) -> bool
pub fn is_alive(&self, nonce: <B::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 Supervising<B, C>where
A: Address + Send,
Sends: SendAlgebra,
B: Behavior<Addr = A, Ph = Ph, Sends = Sends, Birth = Births<C>, Effect = Actions<A, Ph, Sends, Births<C>>, Done = Exit<A>> + Send,
B::Event: ChildEvent<B::Addr> + Send,
A::Nonce: From<u64> + Send,
B::Msg: Send,
C: Behavior<Ph = Never, Addr = B::Addr> + Send,
impl<B, C, A, Ph, Sends> Behavior for Supervising<B, C>where
A: Address + Send,
Sends: SendAlgebra,
B: Behavior<Addr = A, Ph = Ph, Sends = Sends, Birth = Births<C>, Effect = Actions<A, Ph, Sends, Births<C>>, Done = Exit<A>> + Send,
B::Event: ChildEvent<B::Addr> + Send,
A::Nonce: From<u64> + Send,
B::Msg: Send,
C: Behavior<Ph = Never, Addr = B::Addr> + Send,
type Addr = A
type Msg = <B as Behavior>::Msg
type Event = SupervisionEvent<<B as Behavior>::Event, <B as Behavior>::Addr>
type Sends = SendProduct<Sends, SendProduct<ServiceSends<ObserveChild<A>>, Vec<Delivery<A, ProxyCommand<C>>>>>
type Ph = Ph
type Error = <B as Behavior>::Error
type Birth = Births<Proxy<C>>
type Effect = Actions<A, Ph, <Supervising<B, C> as Behavior>::Sends, Births<Proxy<C>>>
type Done = Exit<A>
async fn init(&mut self) -> Result<Self::Effect, B::Error>
async fn step(&mut self, event: Self::Event) -> Result<Self::Effect, B::Error>
Auto Trait Implementations§
impl<B, C> Freeze for Supervising<B, C>where
B: Freeze,
impl<B, C> RefUnwindSafe for Supervising<B, C>
impl<B, C> Send for Supervising<B, C>
impl<B, C> Sync for Supervising<B, C>
impl<B, C> Unpin for Supervising<B, C>
impl<B, C> UnsafeUnpin for Supervising<B, C>where
B: UnsafeUnpin,
impl<B, C> UnwindSafe for Supervising<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