Skip to main content

ShutdownChoice

Enum ShutdownChoice 

Source
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§

§

Child

Fields

§creation: CreationId
§child: PhantomData<fn() -> C>
§

Other(Tail)

Implementations§

Source§

impl<C: Behavior, Tail> ShutdownChoice<C, Tail>

Source

pub const fn child(creation: CreationId) -> Self

Source

pub const fn other(target: Tail) -> Self

Trait Implementations§

Source§

impl<C, Tail> Clone for ShutdownChoice<C, Tail>
where C: Behavior, <BehaviorAddr<C> as Address>::Nonce: Copy, Tail: Copy,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Child: Behavior, Tail> ShutdownTargetAt<Child, ChildHead> for ShutdownChoice<Child, Tail>

Source§

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>
where Head: Behavior, Child: Behavior, Tail: ShutdownTargetAt<Child, Position>,

Source§

fn shutdown_target_at(creation: CreationId) -> Self

Lower one creator-local child ID into its statically selected branch.
Source§

impl<C, Tail> Copy for ShutdownChoice<C, Tail>
where C: Behavior, <BehaviorAddr<C> as Address>::Nonce: Copy, Tail: Copy,

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> 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.