Skip to main content

ChildShutdownPhases

Struct ChildShutdownPhases 

Source
pub struct ChildShutdownPhases<B, Available, Phases> { /* private fields */ }
Expand description

Inferred builder for statically complete child shutdown phases.

Implementations§

Source§

impl<B, Available, Phases> ChildShutdownPhases<B, Available, Phases>
where B: Behavior,

Source

pub fn shutdown_phase<Role>( self, _: Role, ) -> ChildShutdownPhases<B, <Available as AssignAt<<B as ResolveChildOccurrence<Role>>::Position>>::Assigned, Phase<Role, Phases>>
where B: ResolveChildOccurrence<Role>, Available: AssignAt<<B as ResolveChildOccurrence<Role>>::Position>,

Append one child as the next shutdown phase.

Foreign roles, roles declared for another application, wrongly typed roles, and duplicate roles have no applicable implementation.

A duplicate role is rejected independently:

ⓘ
struct Worker;
#[behavior::behavior(addr = behavior::MailAddr, message = behavior::Never)]
impl Worker {
    fn receive(&mut self, _: behavior::MailAddr, message: behavior::Never) -> behavior::BehaviorActed<Self> {
        match message {}
    }
}
type ManagedWorker = behavior_actors::StopOnShutdown<Worker>;
struct Application;
#[behavior::behavior(addr = behavior::MailAddr, message = behavior::Never, births = {
    store: ManagedWorker,
    gateway: ManagedWorker,
}, creation_settlements = retain_for_retirement)]
impl Application {
    fn receive(&mut self, _: behavior::MailAddr, message: behavior::Never) -> behavior::BehaviorActed<Self> {
        match message {}
    }
}
let _ = behavior_actors::shutdown_after_children(Application)
    .shutdown_phase(ApplicationChild::Store)
    .shutdown_phase(ApplicationChild::Store);

A role that belongs to no child declaration is rejected independently:

ⓘ
struct Worker;
#[behavior::behavior(addr = behavior::MailAddr, message = behavior::Never)]
impl Worker {
    fn receive(&mut self, _: behavior::MailAddr, message: behavior::Never) -> behavior::BehaviorActed<Self> {
        match message {}
    }
}
type ManagedWorker = behavior_actors::StopOnShutdown<Worker>;
struct Application;
#[behavior::behavior(addr = behavior::MailAddr, message = behavior::Never, births = {
    store: ManagedWorker,
    gateway: ManagedWorker,
}, creation_settlements = retain_for_retirement)]
impl Application {
    fn receive(&mut self, _: behavior::MailAddr, message: behavior::Never) -> behavior::BehaviorActed<Self> {
        match message {}
    }
}
struct ForeignRole;
let _ = behavior_actors::shutdown_after_children(Application).shutdown_phase(ForeignRole);

A route value cannot stand in for its declared role:

ⓘ
struct Worker;
#[behavior::behavior(addr = behavior::MailAddr, message = behavior::Never)]
impl Worker {
    fn receive(&mut self, _: behavior::MailAddr, message: behavior::Never) -> behavior::BehaviorActed<Self> {
        match message {}
    }
}
type ManagedWorker = behavior_actors::StopOnShutdown<Worker>;
struct Application;
#[behavior::behavior(addr = behavior::MailAddr, message = behavior::Never, births = {
    store: ManagedWorker,
    gateway: ManagedWorker,
}, creation_settlements = retain_for_retirement)]
impl Application {
    fn receive(&mut self, _: behavior::MailAddr, message: behavior::Never) -> behavior::BehaviorActed<Self> {
        match message {}
    }
}
let routes = ApplicationChildrenRoutes::new(1, 2);
let _ = behavior_actors::shutdown_after_children(Application).shutdown_phase(routes.store);
Source§

impl<B, Available, Phases> ChildShutdownPhases<B, Available, Phases>
where B: Behavior, B::Birth: BirthMode, Available: AllAssigned, <B::Birth as BirthMode>::Child: ChildOccurrenceProduct<ShutdownTargets<B>>, Phases: BuildShutdownPlan<B, ChildOccurrences<<<B as Behavior>::Birth as BirthMode>::Child, ShutdownTargets<B>>>, ChildOccurrences<<<B as Behavior>::Birth as BirthMode>::Child, ShutdownTargets<B>>: Selection<Addr = BehaviorAddr<B>> + Copy, <BehaviorAddr<B> as Address>::Nonce: Copy + Eq,

Source

pub fn finish( self, ) -> HeterogeneousShutdownCoordinator<ChildShutdownPlan<B, Phases>, ChildOccurrences<<<B as Behavior>::Birth as BirthMode>::Child, ShutdownTargets<B>>>
where ChildShutdownPlan<B, Phases>: Behavior<Protocol = B::Protocol>,

Complete the application after proving that every child role occurs in exactly one declared phase.

The final actor’s source-indexed event ingress carries the plan through arbitrary outer layers without exposing a structural path.

ⓘ
struct Worker;
#[behavior::behavior(addr = behavior::MailAddr, message = behavior::Never)]
impl Worker {
    fn receive(&mut self, _: behavior::MailAddr, message: behavior::Never) -> behavior::BehaviorActed<Self> {
        match message {}
    }
}
type ManagedWorker = behavior_actors::StopOnShutdown<Worker>;
struct Application;
#[behavior::behavior(addr = behavior::MailAddr, message = behavior::Never, births = {
    store: ManagedWorker,
    gateway: ManagedWorker,
}, creation_settlements = retain_for_retirement)]
impl Application {
    fn receive(&mut self, _: behavior::MailAddr, message: behavior::Never) -> behavior::BehaviorActed<Self> {
        match message {}
    }
}
// `gateway` remains unassigned, so `finish` does not exist here.
let incomplete = behavior_actors::shutdown_after_children(Application)
    .shutdown_phase(ApplicationChild::Store)
    .finish();

Trait Implementations§

Source§

impl<B, Available, Phases, Role> DeclareShutdownPhase<Role> for ChildShutdownPhases<B, Available, Phases>
where B: Behavior + ResolveChildOccurrence<Role>, Available: AssignAt<<B as ResolveChildOccurrence<Role>>::Position>,

Source§

type Output = ChildShutdownPhases<B, <Available as AssignAt<<B as ResolveChildOccurrence<Role>>::Position>>::Assigned, Phase<Role, Phases>>

Source§

fn shutdown_phase(self, role: Role) -> Self::Output

Source§

impl<B, Available, Phases> FinishShutdownPhases for ChildShutdownPhases<B, Available, Phases>
where B: Behavior, B::Birth: BirthMode, Available: AllAssigned, <B::Birth as BirthMode>::Child: ChildOccurrenceProduct<ShutdownTargets<B>>, Phases: BuildShutdownPlan<B, ChildOccurrences<<<B as Behavior>::Birth as BirthMode>::Child, ShutdownTargets<B>>>, ChildOccurrences<<<B as Behavior>::Birth as BirthMode>::Child, ShutdownTargets<B>>: Selection<Addr = BehaviorAddr<B>> + Copy, <BehaviorAddr<B> as Address>::Nonce: Copy + Eq, ChildShutdownPlan<B, Phases>: Behavior<Protocol = B::Protocol>,

Source§

type Output = HeterogeneousShutdownCoordinator<ChildShutdownPlan<B, Phases>, <<<B as Behavior>::Birth as BirthMode>::Child as ChildOccurrenceProduct<ShutdownTargets<B>>>::Product>

Source§

fn finish(self) -> Self::Output

Auto Trait Implementations§

§

impl<B, Available, Phases> Freeze for ChildShutdownPhases<B, Available, Phases>
where B: Freeze,

§

impl<B, Available, Phases> RefUnwindSafe for ChildShutdownPhases<B, Available, Phases>
where B: RefUnwindSafe,

§

impl<B, Available, Phases> Send for ChildShutdownPhases<B, Available, Phases>
where B: Send,

§

impl<B, Available, Phases> Sync for ChildShutdownPhases<B, Available, Phases>
where B: Sync,

§

impl<B, Available, Phases> Unpin for ChildShutdownPhases<B, Available, Phases>
where B: Unpin,

§

impl<B, Available, Phases> UnsafeUnpin for ChildShutdownPhases<B, Available, Phases>
where B: UnsafeUnpin,

§

impl<B, Available, Phases> UnwindSafe for ChildShutdownPhases<B, Available, Phases>
where B: 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.