pub enum ShutdownChoice<C: Behavior, Tail> {
Child {
creation: CreationId,
child: PhantomData<fn() -> C>,
},
Other(Tail),
}Expand description
One member of a closed heterogeneous child-protocol sum.
A root gives the recursive sum a topology-specific alias. Child selects
the protocol at this position; Other selects one of the remaining
protocols. The value carries only the creator-local creation ID, never an erased
actor, address, request, or runtime protocol key.
A child whose event algebra has no direct shutdown owner cannot enter a validated heterogeneous plan:
ⓘ
struct Plain;
impl behavior::Protocol for Plain { type Addr = behavior::MailAddr; type Msg = (); }
impl behavior::Behavior for Plain {
type Protocol = Self;
type Event = behavior::User<behavior::MailAddr, ()>;
type Sends = Vec<behavior::Never>;
type Ph = behavior::Never;
type Error = behavior::Never;
type Birth = behavior::NoBirths;
fn transition(&mut self, _: behavior::ActiveTurn, _: Self::Event) -> behavior::BehaviorActed<Self> {
Ok(behavior::Actions::cont())
}
}
type Targets = behavior_actors::ShutdownChoice<Plain, behavior_actors::NoShutdownTargets<behavior::MailAddr>>;
let child = behavior::CreationSequence::new()
.issue()
.expect("the first child creation ID exists");
let _ = behavior_actors::HeterogeneousShutdownPlan::new([vec![Targets::child(child)]]);Variants§
Implementations§
Source§impl<C: Behavior, Tail> ShutdownChoice<C, Tail>
impl<C: Behavior, Tail> ShutdownChoice<C, Tail>
pub const fn child(creation: CreationId) -> Self
pub const fn other(target: Tail) -> Self
Trait Implementations§
Source§impl<C, Tail> Clone for ShutdownChoice<C, Tail>
impl<C, Tail> Clone for ShutdownChoice<C, Tail>
Source§impl<Child: Behavior, Tail> ShutdownTargetAt<Child, ChildHead> for ShutdownChoice<Child, Tail>
impl<Child: Behavior, Tail> ShutdownTargetAt<Child, ChildHead> for ShutdownChoice<Child, Tail>
Source§fn shutdown_target_at(creation: CreationId) -> Self
fn shutdown_target_at(creation: CreationId) -> Self
Lower one creator-local child ID into its statically selected branch.
Source§impl<Head, Tail, Child, Position> ShutdownTargetAt<Child, ChildTail<Position>> for ShutdownChoice<Head, Tail>
impl<Head, Tail, Child, Position> ShutdownTargetAt<Child, ChildTail<Position>> for ShutdownChoice<Head, Tail>
Source§fn shutdown_target_at(creation: CreationId) -> Self
fn shutdown_target_at(creation: CreationId) -> Self
Lower one creator-local child ID into its statically selected branch.
impl<C, Tail> Copy for ShutdownChoice<C, Tail>
Auto Trait Implementations§
impl<C, Tail> Freeze for ShutdownChoice<C, Tail>where
Tail: Freeze,
impl<C, Tail> RefUnwindSafe for ShutdownChoice<C, Tail>where
Tail: RefUnwindSafe,
impl<C, Tail> Send for ShutdownChoice<C, Tail>where
Tail: Send,
impl<C, Tail> Sync for ShutdownChoice<C, Tail>where
Tail: Sync,
impl<C, Tail> Unpin for ShutdownChoice<C, Tail>where
Tail: Unpin,
impl<C, Tail> UnsafeUnpin for ShutdownChoice<C, Tail>where
Tail: UnsafeUnpin,
impl<C, Tail> UnwindSafe for ShutdownChoice<C, Tail>where
Tail: UnwindSafe,
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