Skip to main content

Supervisor

Struct Supervisor 

Source
pub struct Supervisor<B: Behavior, C: Behavior<Ph = Never, Addr = B::Addr>> { /* private fields */ }

Implementations§

Source§

impl<B, C> Supervisor<B, C>
where B: Behavior<Birth = Births<C>>, C: Behavior<Ph = Never, Addr = B::Addr>,

Source

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 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.

Source

pub fn with_strategy(self, strategy: Strategy) -> Self

Source

pub fn with_policy(self, policy: RestartPolicy) -> Self

Source

pub fn with_budget(self, max: u32, window: Duration) -> Self

Source

pub fn with_failure_reaction( self, reaction: SupervisionFailureReaction<B>, ) -> Self

Replace the pure reaction used for typed supervision failures.

Source

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.

Source

pub fn child_count(&self) -> usize

Source

pub fn restarts_in_window(&self) -> usize

Trait Implementations§

Source§

impl<B, C, A, Ph, Sends> Behavior for Supervisor<B, C>
where A: Address, Sends: SendAlgebra, B: Behavior<Addr = A, Ph = Ph, Sends = Sends, Birth = Births<C>>, B::Event: ChildEvent + CreationEvent + WorkerCreationEvent, A::Nonce: From<u64>, C: Behavior<Ph = Never, Addr = B::Addr>,

Source§

type Addr = A

Source§

type Msg = <B as Behavior>::Msg

Source§

type Event = SupervisionEvent<<B as Behavior>::Event>

Source§

type Sends = SupervisorSends<A, Sends, C>

Source§

type Ph = Ph

Source§

type Error = <B as Behavior>::Error

Source§

type Birth = Births<Proxy<C>>

Source§

fn init(&mut self) -> Result<SupervisorActions<B, C>, B::Error>

Produce initialization actions before the first event is accepted. Read more
Source§

fn transition( &mut self, event: Self::Event, ) -> Result<SupervisorActions<B, C>, B::Error>

Fold exactly one event into explicit actions and the next behavior. Read more
Source§

fn receive( &mut self, from: Self::Addr, message: Self::Msg, ) -> BehaviorActed<Self>
where Self: Sized,

Fold one user communication through the composed protocol. Read more
Source§

fn on<Input>(&mut self, input: Input) -> BehaviorActed<Self>
where Self: Sized, Self::Event: EventInput<Input>,

Inject one supported semantic input and fold it through this 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>
where B: Send, <<B as Behavior>::Addr as Address>::Nonce: Send,

§

impl<B, C> Sync for Supervisor<B, C>
where B: Sync, <<B as Behavior>::Addr as Address>::Nonce: Sync,

§

impl<B, C> Unpin for Supervisor<B, C>
where B: Unpin, <<B as Behavior>::Addr as Address>::Nonce: Unpin,

§

impl<B, C> UnsafeUnpin for Supervisor<B, C>
where B: UnsafeUnpin,

§

impl<B, C> UnwindSafe for Supervisor<B, C>
where B: UnwindSafe, <<B as Behavior>::Addr as Address>::Nonce: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.