Skip to main content

ProtocolAction

Enum ProtocolAction 

Source
pub enum ProtocolAction {
Show 16 variants Send { performative: Performative, to: Option<String>, fields: Option<BTreeMap<String, String>>, retry: Option<Retry>, }, Begin, Fulfil, Retract { target: String, }, Set { name: String, field: Option<String>, expr: Expr, }, Push { state: String, expr: Expr, }, Put { state: String, key: String, expr: Expr, }, For { var: String, over: String, actions: Vec<ProtocolAction>, }, Abort, Return { expr: Expr, }, Broadcast { performative: Performative, fields: Option<BTreeMap<String, String>>, to: String, }, Enter { phase: String, }, BeginId { id: String, }, FulfilId { id: String, }, Try { body: Vec<ProtocolAction>, catch: Vec<ProtocolAction>, }, Await { count: i64, performative: Performative, into: String, within_ms: i64, flag: String, },
}
Expand description

What a handler does. Phase 1: the speech-act statement set.

Variants§

§

Send

send propose to seller — MUST be dialogue-legal for the trigger; to names the receiving role (defaults to the counterpart)

Fields

§performative: Performative
§retry: Option<Retry>
§

Begin

begin — activate the pending commitment (proposed -> active)

§

Fulfil

fulfil — mark the commitment fulfilled (active -> fulfilled)

§

Retract

retract(fact_name) — belief revision as a statement (§32.1)

Fields

§target: String
§

Set

§35.1: set <state> = <expr>; — field targets a record field (set q.price = 5;)

Fields

§name: String
§expr: Expr
§

Push

§35.2: push <state>, <expr>; — append to a list state

Fields

§state: String
§expr: Expr
§

Put

§35.2: put <state>, <key>, <expr>; — set a map entry

Fields

§state: String
§expr: Expr
§

For

§35.3: for <var> in <list_state> { ... } — fan-out over a collection

Fields

§over: String
§

Abort

§35.4: abort; — trigger compensation handlers immediately

§

Return

§38.1: return <expr>; — only legal inside a function body

Fields

§expr: Expr
§

Broadcast

§38.8: broadcast <perf> [payload] to <list_state>; — fan-out to every role named in a list state (contract-net announce)

Fields

§performative: Performative
§

Enter

§50: enter <phase>; — transition the session’s conversation phase

Fields

§phase: String
§

BeginId

§51: begin <id>; / fulfil <id>; — NAMED commitments (several obligations per session, each with its own lifecycle)

Fields

§

FulfilId

Fields

§

Try

§45: try { ... } catch { ... }; — a failing action inside the body (set/push/put eval error, container violation, fmt failure) cuts the body short and runs the catch actions instead of routing to the session’s on error handler

§

Await

§44: await N <perf> into <list> within <dur> as <flag>; — declarative collection: matching events push their payload into the list state; when N arrive the flag goes true; on deadline it goes false. No handler needs to be written for the collected events.

Fields

§count: i64
§performative: Performative
§into: String
§within_ms: i64
§flag: String

Trait Implementations§

Source§

impl Clone for ProtocolAction

Source§

fn clone(&self) -> ProtocolAction

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ProtocolAction

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ProtocolAction

Source§

fn eq(&self, other: &ProtocolAction) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ProtocolAction

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> 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> Same for T

Source§

type Output = T

Should always be Self
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.