Skip to main content

Delivery

Struct Delivery 

Source
pub struct Delivery { /* private fields */ }
Expand description

One event and, at a strong decision point, its exactly-once decision guard.

Most deliveries are ordinary transport: read the event and move on. Three kinds are not — they are a rendezvous the Run is blocked on, and it does not proceed until this delivery is accepted or rejected. Dropping one undecided rejects it.

You never have to know which three. decision_point says so per delivery, which makes the whole acceptance protocol one line:

if delivery.decision_point().is_some() {
    delivery.accept()?;
}

A consumer that means to refuse the governed work — an approval policy that says no, a host shutting down — calls reject instead, and the tool call it guards never runs.

Implementations§

Source§

impl Delivery

Source

pub const fn event(&self) -> &Event

Returns the immutable event.

Source

pub const fn decision_point(&self) -> Option<DecisionPoint>

Returns the strong decision point, or None for ordinary transport delivery.

Source

pub fn accept(&self) -> Result<(), DecisionError>

Accepts this strong boundary exactly once.

§Errors
  • DecisionError::NotRequired if this is ordinary transport delivery rather than one of the three strong seams. Check decision_point to tell them apart; nothing is owed for an ordinary delivery and nothing happens if it is dropped undecided.
  • DecisionError::AlreadyDecided if this delivery has already been decided, or if cancellation resolved it first. A cancelled Run’s deliveries report this even on a first call, because acceptance would authorize work the Run is already unwinding out of — so a consumer cannot treat this variant as “somebody else said yes”.

Either way the governed work does not proceed on this call’s authority, and the decision that did win is not displaced.

Source

pub fn reject(&self) -> Result<(), DecisionError>

Rejects this strong boundary exactly once.

§Errors

DecisionError::NotRequired if this is ordinary transport delivery, or DecisionError::AlreadyDecided if a decision or a cancellation already won — the same two conditions accept reports, for the same reasons.

Neither is a reason to retry: a delivery that fails to reject was already resolved to something that also stops the governed work, since dropping an undecided delivery rejects it and cancellation outranks both.

Trait Implementations§

Source§

impl Debug for Delivery

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Shows the event, the decision point, and whether a decision is owed.

The decision guard is reported by presence rather than by state: reading its state would mean loading the very atomic whose exactly-once transition the guard exists to serialise, and a formatter has no business participating in that handshake.

Source§

impl Drop for Delivery

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.