Skip to main content

ShutdownEstablished

Struct ShutdownEstablished 

Source
pub struct ShutdownEstablished<B, TargetPath>{
    pub id: ShutdownId,
    /* private fields */
}
Expand description

Request orderly shutdown of one exact installed concrete behavior.

TargetPath proves where ShutdownRequested enters the installed behavior’s closed event algebra. The interpreter receives that typed ingress together with the exact installed actor; shutdown is therefore still an explicit event/effect transformation, not a privileged runtime side channel.

A concrete actor whose event algebra has no shutdown ingress cannot be strengthened into an orderly-shutdown request:

ⓘ
#[derive(Clone, Copy, PartialEq, Eq)]
struct RuntimeAddr(u64);
impl behavior::Address for RuntimeAddr { type Nonce = u64; }
struct Endpoint;
impl Clone for Endpoint { fn clone(&self) -> Self { Self } }
struct Installed<B: behavior::Behavior>(Endpoint, std::sync::mpsc::Sender<B::Event>);
impl<B: behavior::Behavior> Clone for Installed<B> {
    fn clone(&self) -> Self { Self(self.0.clone(), self.1.clone()) }
}
impl behavior::EndpointAddress for RuntimeAddr {
    type Established<P> = Endpoint where P: behavior::Protocol<Addr = Self>;
    type Installed<B> = Installed<B>
        where B: behavior::Behavior<Protocol: behavior::Protocol<Addr = Self>>;
    fn recipient<B>(installed: &Self::Installed<B>) -> Endpoint
    where B: behavior::Behavior<Protocol: behavior::Protocol<Addr = Self>> {
        installed.0.clone()
    }
}
struct Worker;
impl behavior::Protocol for Worker { type Addr = RuntimeAddr; type Msg = (); }
impl behavior::Behavior for Worker {
    type Protocol = Self;
    type Event = behavior::User<RuntimeAddr, ()>;
    type Sends = behavior::NoSends;
    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()) }
}
let (control, _inbox) = std::sync::mpsc::channel::<<Worker as behavior::Behavior>::Event>();
let actor = behavior::EstablishedActor::<Worker>::issued(Installed(Endpoint, control));
let _ = behavior_actors::ShutdownEstablished::<Worker, behavior::Here>::new(
    behavior_actors::ShutdownId(1),
    actor,
    behavior::Ingress::<behavior_actors::ShutdownRequested, behavior::Here>::new(),
);

Fields§

§id: ShutdownId

Implementations§

Source§

impl<B, TargetPath> ShutdownEstablished<B, TargetPath>

Source

pub const fn new( id: ShutdownId, actor: EstablishedActor<B>, ingress: Ingress<ShutdownRequested, TargetPath>, ) -> Self

Source

pub fn actor(&self) -> EstablishedActor<B>

Clone the exact actor capability without changing request ownership.

Source

pub fn settle<I>( self, interpreter: &mut I, ) -> ItemSettlement<Self, ShutdownId, ShutdownRejection, Never>
where I: InterpretEstablishedShutdown<B, TargetPath>,

Attempt this request and return its one statically selected settlement.

Trait Implementations§

Source§

impl<B, TargetPath> ActionItem for ShutdownEstablished<B, TargetPath>

Source§

type Custody = (Option<ShutdownEstablished<B, TargetPath>>, Option<<ShutdownEstablished<B, TargetPath> as ActionItem>::Reply>)

Source§

type Input<'a> = &'a mut Option<ShutdownEstablished<B, TargetPath>> where Self: 'a

Source§

type Reply = ItemSettlement<ShutdownEstablished<B, TargetPath>, <ShutdownEstablished<B, TargetPath> as ActionItem>::Accepted, <ShutdownEstablished<B, TargetPath> as ActionItem>::Rejection, <ShutdownEstablished<B, TargetPath> as ActionItem>::Prerequisite>

Source§

type Accepted = ShutdownId

Source§

type Rejection = ShutdownRejection

Source§

type Prerequisite = Never

Source§

fn prepare_interpretation( progress: &mut Option<InterpretationProgress<Self, Self::Custody, Self::Reply>>, )

Source§

fn interpretation_input<'a>( custody: &'a mut Self::Custody, ) -> Option<(Self::Input<'a>, &'a mut Option<Self::Reply>)>
where Self: 'a,

Source§

fn finish_interpretation( progress: &mut Option<InterpretationProgress<Self, Self::Custody, Self::Reply>>, )

Source§

fn retain_accepted(_: Self::Accepted) -> Option<Self::Accepted>

Keep an accepted value only while it still carries terminal custody. Read more
Source§

impl<B, TargetPath> InterpreterRequest for ShutdownEstablished<B, TargetPath>

Auto Trait Implementations§

§

impl<B, TargetPath> Freeze for ShutdownEstablished<B, TargetPath>

§

impl<B, TargetPath> RefUnwindSafe for ShutdownEstablished<B, TargetPath>

§

impl<B, TargetPath> Send for ShutdownEstablished<B, TargetPath>

§

impl<B, TargetPath> Sync for ShutdownEstablished<B, TargetPath>

§

impl<B, TargetPath> Unpin for ShutdownEstablished<B, TargetPath>

§

impl<B, TargetPath> UnsafeUnpin for ShutdownEstablished<B, TargetPath>

§

impl<B, TargetPath> UnwindSafe for ShutdownEstablished<B, TargetPath>

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.