pub struct Choreography {
pub name: Ident,
pub namespace: Option<String>,
pub roles: Vec<Role>,
pub protocol: Protocol,
pub attrs: HashMap<String, String>,
}Expand description
A complete choreographic protocol specification
Fields§
§name: IdentProtocol name
namespace: Option<String>Optional namespace for the protocol
roles: Vec<Role>Participating roles
protocol: ProtocolThe protocol specification
attrs: HashMap<String, String>Metadata and attributes
Implementations§
Source§impl Choreography
impl Choreography
Sourcepub fn qualified_name(&self) -> String
pub fn qualified_name(&self) -> String
Get the qualified name of the choreography (namespace::name or just name)
Sourcepub fn validate(&self) -> Result<(), ValidationError>
pub fn validate(&self) -> Result<(), ValidationError>
Validate the choreography for correctness
§Errors
Returns ValidationError if the choreography is invalid (unused roles,
malformed protocol, duplicate/missing proof bundles, or missing capabilities).
pub fn language_tier_status(&self) -> LanguageTierStatus
Sourcepub fn get_attributes(&self) -> &HashMap<String, String>
pub fn get_attributes(&self) -> &HashMap<String, String>
Get choreography-level attributes/annotations
Sourcepub fn get_attributes_mut(&mut self) -> &mut HashMap<String, String>
pub fn get_attributes_mut(&mut self) -> &mut HashMap<String, String>
Get mutable reference to choreography-level attributes
Sourcepub fn get_attribute(&self, key: &str) -> Option<&String>
pub fn get_attribute(&self, key: &str) -> Option<&String>
Get a specific choreography attribute
Sourcepub fn set_attribute(&mut self, key: String, value: String)
pub fn set_attribute(&mut self, key: String, value: String)
Set a choreography attribute
Sourcepub fn remove_attribute(&mut self, key: &str) -> Option<String>
pub fn remove_attribute(&mut self, key: &str) -> Option<String>
Remove a choreography attribute
Sourcepub fn has_attribute(&self, key: &str) -> bool
pub fn has_attribute(&self, key: &str) -> bool
Check if choreography has a specific attribute
Sourcepub fn get_attribute_as<T>(&self, key: &str) -> Option<T>where
T: FromStr,
pub fn get_attribute_as<T>(&self, key: &str) -> Option<T>where
T: FromStr,
Get attribute as a specific type
Sourcepub fn get_attribute_as_bool(&self, key: &str) -> Option<bool>
pub fn get_attribute_as_bool(&self, key: &str) -> Option<bool>
Get attribute as boolean
Sourcepub fn clear_attributes(&mut self)
pub fn clear_attributes(&mut self)
Clear all choreography attributes
Sourcepub fn attribute_count(&self) -> usize
pub fn attribute_count(&self) -> usize
Count of choreography attributes
Sourcepub fn attribute_keys(&self) -> Vec<&String>
pub fn attribute_keys(&self) -> Vec<&String>
Get all attribute keys
Sourcepub fn validate_required_attributes(
&self,
required_keys: &[&str],
) -> Result<(), Vec<String>>
pub fn validate_required_attributes( &self, required_keys: &[&str], ) -> Result<(), Vec<String>>
Validate that required attributes are present
Sourcepub fn find_nodes_with_annotation(&self, key: &str) -> Vec<&Protocol>
pub fn find_nodes_with_annotation(&self, key: &str) -> Vec<&Protocol>
Find all protocol nodes with a specific annotation
Sourcepub fn find_nodes_with_annotation_value(
&self,
key: &str,
value: &str,
) -> Vec<&Protocol>
pub fn find_nodes_with_annotation_value( &self, key: &str, value: &str, ) -> Vec<&Protocol>
Find all protocol nodes with a specific annotation value
Sourcepub fn total_annotation_count(&self) -> usize
pub fn total_annotation_count(&self) -> usize
Count total annotations across the entire choreography
Sourcepub fn set_theorem_packs(
&mut self,
theorem_packs: &[TheoremPackDeclaration],
) -> Result<(), String>
pub fn set_theorem_packs( &mut self, theorem_packs: &[TheoremPackDeclaration], ) -> Result<(), String>
Set theorem-pack declarations for this choreography.
Sourcepub fn theorem_packs(&self) -> Vec<TheoremPackDeclaration>
pub fn theorem_packs(&self) -> Vec<TheoremPackDeclaration>
Get typed theorem-pack declarations.
Sourcepub fn set_required_theorem_packs(
&mut self,
required: &[String],
) -> Result<(), String>
pub fn set_required_theorem_packs( &mut self, required: &[String], ) -> Result<(), String>
Set protocol-required theorem packs.
Sourcepub fn required_theorem_packs(&self) -> Vec<String>
pub fn required_theorem_packs(&self) -> Vec<String>
Get protocol-required theorem packs.
Sourcepub fn set_inferred_required_theorem_packs(
&mut self,
required: &[String],
) -> Result<(), String>
pub fn set_inferred_required_theorem_packs( &mut self, required: &[String], ) -> Result<(), String>
Set inferred protocol-required theorem packs.
Sourcepub fn inferred_required_theorem_packs(&self) -> Vec<String>
pub fn inferred_required_theorem_packs(&self) -> Vec<String>
Get inferred protocol-required theorem packs.
Sourcepub fn set_role_sets(
&mut self,
role_sets: &[RoleSetDeclaration],
) -> Result<(), String>
pub fn set_role_sets( &mut self, role_sets: &[RoleSetDeclaration], ) -> Result<(), String>
Set role-set declarations for this choreography.
Sourcepub fn role_sets(&self) -> Vec<RoleSetDeclaration>
pub fn role_sets(&self) -> Vec<RoleSetDeclaration>
Get typed role-set declarations.
Sourcepub fn set_topologies(
&mut self,
topologies: &[TopologyDeclaration],
) -> Result<(), String>
pub fn set_topologies( &mut self, topologies: &[TopologyDeclaration], ) -> Result<(), String>
Set topology declarations for this choreography.
Sourcepub fn topologies(&self) -> Vec<TopologyDeclaration>
pub fn topologies(&self) -> Vec<TopologyDeclaration>
Get typed topology declarations.
Sourcepub fn set_type_declarations(
&mut self,
decls: &[TypeDeclaration],
) -> Result<(), String>
pub fn set_type_declarations( &mut self, decls: &[TypeDeclaration], ) -> Result<(), String>
Set nominal type declarations for this choreography.
Sourcepub fn type_declarations(&self) -> Vec<TypeDeclaration>
pub fn type_declarations(&self) -> Vec<TypeDeclaration>
Get nominal type declarations.
Sourcepub fn set_effect_interface_declarations(
&mut self,
decls: &[EffectInterfaceDeclaration],
) -> Result<(), String>
pub fn set_effect_interface_declarations( &mut self, decls: &[EffectInterfaceDeclaration], ) -> Result<(), String>
Set nominal effect interface declarations for this choreography.
Sourcepub fn effect_interface_declarations(&self) -> Vec<EffectInterfaceDeclaration>
pub fn effect_interface_declarations(&self) -> Vec<EffectInterfaceDeclaration>
Get nominal effect interface declarations.
Sourcepub fn effect_contract_declarations(&self) -> Vec<EffectContractDeclaration>
pub fn effect_contract_declarations(&self) -> Vec<EffectContractDeclaration>
Derive runtime-facing effect metadata from nominal effect declarations
and protocol uses dependencies.
Sourcepub fn set_protocol_uses(&mut self, uses: &[String]) -> Result<(), String>
pub fn set_protocol_uses(&mut self, uses: &[String]) -> Result<(), String>
Set explicit protocol effect dependencies.
Sourcepub fn protocol_uses(&self) -> Vec<String>
pub fn protocol_uses(&self) -> Vec<String>
Get explicit protocol effect dependencies.
Sourcepub fn set_region_declarations(
&mut self,
decls: &[RegionDeclaration],
) -> Result<(), String>
pub fn set_region_declarations( &mut self, decls: &[RegionDeclaration], ) -> Result<(), String>
Set region declarations for this choreography.
Sourcepub fn region_declarations(&self) -> Vec<RegionDeclaration>
pub fn region_declarations(&self) -> Vec<RegionDeclaration>
Get region declarations.
Sourcepub fn set_operation_declarations(
&mut self,
decls: &[OperationDeclaration],
) -> Result<(), String>
pub fn set_operation_declarations( &mut self, decls: &[OperationDeclaration], ) -> Result<(), String>
Set operation declarations for this choreography.
Sourcepub fn operation_declarations(&self) -> Vec<OperationDeclaration>
pub fn operation_declarations(&self) -> Vec<OperationDeclaration>
Get operation declarations.
Sourcepub fn set_guest_runtime_declarations(
&mut self,
decls: &[GuestRuntimeDeclaration],
) -> Result<(), String>
pub fn set_guest_runtime_declarations( &mut self, decls: &[GuestRuntimeDeclaration], ) -> Result<(), String>
Set guest-runtime declarations for this choreography.
Sourcepub fn guest_runtime_declarations(&self) -> Vec<GuestRuntimeDeclaration>
pub fn guest_runtime_declarations(&self) -> Vec<GuestRuntimeDeclaration>
Get guest-runtime declarations.
Sourcepub fn set_execution_profile_declarations(
&mut self,
decls: &[ExecutionProfileDeclaration],
) -> Result<(), String>
pub fn set_execution_profile_declarations( &mut self, decls: &[ExecutionProfileDeclaration], ) -> Result<(), String>
Set execution-profile declarations for this choreography.
Sourcepub fn execution_profile_declarations(&self) -> Vec<ExecutionProfileDeclaration>
pub fn execution_profile_declarations(&self) -> Vec<ExecutionProfileDeclaration>
Get execution-profile declarations.
Sourcepub fn set_protocol_execution_profiles(
&mut self,
profiles: &[String],
) -> Result<(), String>
pub fn set_protocol_execution_profiles( &mut self, profiles: &[String], ) -> Result<(), String>
Set protocol-selected execution profiles.
Sourcepub fn protocol_execution_profiles(&self) -> Vec<String>
pub fn protocol_execution_profiles(&self) -> Vec<String>
Get protocol-selected execution profiles.
Sourcepub fn set_agreement_profile_declarations(
&mut self,
decls: &[AgreementProfileDeclaration],
) -> Result<(), String>
pub fn set_agreement_profile_declarations( &mut self, decls: &[AgreementProfileDeclaration], ) -> Result<(), String>
Set reusable agreement-profile declarations for this choreography.
Sourcepub fn agreement_profile_declarations(&self) -> Vec<AgreementProfileDeclaration>
pub fn agreement_profile_declarations(&self) -> Vec<AgreementProfileDeclaration>
Get reusable agreement-profile declarations.