Skip to main content

Protocol

Enum Protocol 

Source
pub enum Protocol {
Show 21 variants Begin { operation: String, args: Vec<String>, progress: Option<ProgressAttachment>, continuation: Box<Protocol>, }, Await { operation: String, continuation: Box<Protocol>, }, Resolve { operation: String, outcome: CommitmentOutcome, continuation: Box<Protocol>, }, Invalidate { operation: String, continuation: Box<Protocol>, }, Send { from: Role, to: Role, message: MessageType, continuation: Box<Protocol>, annotations: Annotations, from_annotations: Annotations, to_annotations: Annotations, }, Broadcast { from: Role, to_all: NonEmptyVec<Role>, message: MessageType, continuation: Box<Protocol>, annotations: Annotations, from_annotations: Annotations, }, Choice { role: Role, branches: NonEmptyVec<Branch>, annotations: Annotations, }, Let { name: String, mode: AuthorityBindingMode, expr: AuthorityExpr, linear: bool, continuation: Box<Protocol>, }, Case { expr: AuthorityExpr, branches: NonEmptyVec<CaseBranch>, }, Timeout { role: Role, duration_ms: u64, body: Box<Protocol>, on_timeout: Box<Protocol>, on_cancel: Option<Box<Protocol>>, }, Loop { condition: Option<Condition>, body: Box<Protocol>, }, Parallel { protocols: NonEmptyVec<Protocol>, }, Rec { label: Ident, body: Box<Protocol>, }, Var(Ident), Publish { event: String, arg: Option<String>, continuation: Box<Protocol>, }, PublishAuthority { witness: String, publication_name: String, continuation: Box<Protocol>, }, Materialize { proof: String, publication: String, continuation: Box<Protocol>, }, Handoff { operation: String, target: Role, receipt: String, continuation: Box<Protocol>, }, DependentWork { name: String, arg: Option<String>, required_for: String, continuation: Box<Protocol>, }, Extension { extension: Box<dyn ProtocolExtension>, continuation: Box<Protocol>, annotations: Annotations, }, End,
}
Expand description

Protocol specification using choreographic constructs

Variants§

§

Begin

Begin one explicit semantic operation instance.

Fields

§operation: String
§args: Vec<String>
§continuation: Box<Protocol>
§

Await

Await one previously begun semantic operation instance.

Fields

§operation: String
§continuation: Box<Protocol>
§

Resolve

Resolve one previously begun semantic operation instance.

Fields

§operation: String
§continuation: Box<Protocol>
§

Invalidate

Invalidate one previously begun semantic operation instance.

Fields

§operation: String
§continuation: Box<Protocol>
§

Send

Message send: A -> B: Message

Fields

§from: Role
§to: Role
§message: MessageType
§continuation: Box<Protocol>
§annotations: Annotations

Statement-level annotations

§from_annotations: Annotations

From role annotations

§to_annotations: Annotations

To role annotations

§

Broadcast

Broadcast: A -> *: Message

Fields

§from: Role
§message: MessageType
§continuation: Box<Protocol>
§annotations: Annotations

Statement-level annotations

§from_annotations: Annotations

From role annotations

§

Choice

Choice made by a role

Fields

§role: Role
§annotations: Annotations

Statement-level annotations

§

Let

Local authority/evidence binding.

Fields

§name: String

Bound variable name.

§mode: AuthorityBindingMode

Whether the binding is authoritative, observational, or plain.

§expr: AuthorityExpr

Bound expression.

§linear: bool

Whether the binding is linear/single-use.

§continuation: Box<Protocol>

Continuation after the binding.

§

Case

Local authority/result match.

Fields

§expr: AuthorityExpr

Scrutinee expression.

§branches: NonEmptyVec<CaseBranch>

Match branches.

§

Timeout

Explicit timeout/cancel surface syntax prior to projection lowering.

Fields

§role: Role

Role that owns the timeout decision.

§duration_ms: u64

Timeout duration in milliseconds.

§body: Box<Protocol>

Main body before timeout fires.

§on_timeout: Box<Protocol>

Timeout branch.

§on_cancel: Option<Box<Protocol>>

Optional explicit cancellation branch.

§

Loop

Loop construct

Fields

§condition: Option<Condition>
§

Parallel

Parallel composition

Fields

§

Rec

Recursive protocol with label

Fields

§label: Ident
§

Var(Ident)

Reference to recursive label

§

Publish

Canonical semantic publication surface.

Fields

§event: String
§continuation: Box<Protocol>
§

PublishAuthority

Canonical publication that lifts an authoritative witness into a named publication.

Fields

§witness: String
§publication_name: String
§continuation: Box<Protocol>
§

Materialize

Canonical materialization from one named publication.

Fields

§proof: String
§publication: String
§continuation: Box<Protocol>
§

Handoff

Explicit semantic owner handoff.

Fields

§operation: String
§target: Role
§receipt: String
§continuation: Box<Protocol>
§

DependentWork

Declared semantically required dependent work.

Fields

§name: String
§required_for: String
§continuation: Box<Protocol>
§

Extension

Protocol extension point for custom behaviors

Fields

§extension: Box<dyn ProtocolExtension>

The extension implementation

§continuation: Box<Protocol>

Continuation after this extension

§annotations: Annotations

Statement-level annotations

§

End

Protocol termination

Implementations§

Source§

impl Protocol

Source

pub fn mentions_role(&self, role: &Role) -> bool

Source

pub fn get_annotations(&self) -> &Annotations

Get statement-level annotations for this protocol node

Source

pub fn get_from_annotations(&self) -> Option<&Annotations>

Get from-role annotations for Send/Broadcast statements

Source

pub fn get_to_annotations(&self) -> Option<&Annotations>

Get to-role annotations for Send statements

Source

pub fn get_annotations_mut(&mut self) -> Option<&mut Annotations>

Get mutable reference to annotations for modification

Source

pub fn get_from_annotations_mut(&mut self) -> Option<&mut Annotations>

Get mutable reference to from-role annotations

Source

pub fn get_to_annotations_mut(&mut self) -> Option<&mut Annotations>

Get mutable reference to to-role annotations

Source

pub fn add_annotation(&mut self, annotation: ProtocolAnnotation) -> bool

Add a typed annotation

Source

pub fn clear_annotations(&mut self)

Clear all annotations on this protocol node

Source

pub fn has_any_annotations(&self) -> bool

Check if any annotations are present

Source

pub fn annotation_count(&self) -> usize

Count total number of annotations (statement + role annotations)

Source

pub fn merge_annotations_from(&mut self, other: &Protocol)

Merge annotations from another protocol node

Source

pub fn validate_required_annotations( &self, required_keys: &[&str], ) -> Result<(), Vec<String>>

Validate that required annotations are present

Source

pub fn collect_nodes_with_annotation<'a>( &'a self, key: &str, nodes: &mut Vec<&'a Protocol>, )

Collect all protocol nodes that have a specific annotation (recursive traversal)

Source

pub fn collect_nodes_with_annotation_value<'a>( &'a self, key: &str, value: &str, nodes: &mut Vec<&'a Protocol>, )

Collect all protocol nodes that have a specific annotation with a specific value

Source

pub fn deep_annotation_count(&self) -> usize

Count total annotations throughout the protocol tree (recursive)

Source

pub fn visit_annotated_nodes<F>(&self, f: &mut F)
where F: FnMut(&Protocol),

Apply a function to all protocol nodes that have annotations (visitor pattern)

Source

pub fn visit_annotated_nodes_mut<F>(&mut self, f: &mut F)
where F: FnMut(&mut Protocol),

Apply a mutable function to all protocol nodes that have annotations

Trait Implementations§

Source§

impl Clone for Protocol

Source§

fn clone(&self) -> Protocol

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 Debug for Protocol

Source§

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

Formats the value using the given formatter. 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> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

Source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
Source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

Source§

fn lossy_into(self) -> Dst

Performs the conversion.
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> StrictAs for T

Source§

fn strict_as<Dst>(self) -> Dst
where T: StrictCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> StrictCastFrom<Src> for Dst
where Src: StrictCast<Dst>,

Source§

fn strict_cast_from(src: Src) -> Dst

Casts the value.
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.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.