pub trait Pact: Debug + ReadWritePact {
Show 19 methods
// Required methods
fn consumer(&self) -> Consumer;
fn provider(&self) -> Provider;
fn interactions(
&self,
) -> Vec<Box<dyn Interaction + Send + Sync + RefUnwindSafe>>;
fn interactions_mut(&mut self) -> Vec<&mut (dyn Interaction + Send + Sync)>;
fn metadata(&self) -> BTreeMap<String, BTreeMap<String, String>>;
fn to_json(&self, pact_spec: PactSpecification) -> Result<Value>;
fn as_request_response_pact(&self) -> Result<RequestResponsePact>;
fn as_message_pact(&self) -> Result<MessagePact>;
fn as_v4_pact(&self) -> Result<V4Pact>;
fn specification_version(&self) -> PactSpecification;
fn boxed(&self) -> Box<dyn Pact + Send + Sync + RefUnwindSafe>;
fn arced(&self) -> Arc<dyn Pact + Send + Sync + RefUnwindSafe>;
fn thread_safe(&self) -> Arc<Mutex<dyn Pact + Send + Sync + RefUnwindSafe>>;
fn add_interaction(&mut self, interaction: &dyn Interaction) -> Result<()>;
fn requires_plugins(&self) -> bool;
fn plugin_data(&self) -> Vec<PluginData>;
fn is_v4(&self) -> bool;
fn add_plugin(
&mut self,
name: &str,
version: &str,
plugin_data: Option<HashMap<String, Value>>,
) -> Result<()>;
fn add_md_version(&mut self, key: &str, version: &str);
}Expand description
Trait for a Pact (request/response or message)
Required Methods§
Sourcefn interactions(
&self,
) -> Vec<Box<dyn Interaction + Send + Sync + RefUnwindSafe>>
fn interactions( &self, ) -> Vec<Box<dyn Interaction + Send + Sync + RefUnwindSafe>>
Interactions in the Pact
Sourcefn interactions_mut(&mut self) -> Vec<&mut (dyn Interaction + Send + Sync)>
fn interactions_mut(&mut self) -> Vec<&mut (dyn Interaction + Send + Sync)>
Mutable collection of interactions in the Pact
Sourcefn to_json(&self, pact_spec: PactSpecification) -> Result<Value>
fn to_json(&self, pact_spec: PactSpecification) -> Result<Value>
Converts this pact to a Value struct.
Sourcefn as_request_response_pact(&self) -> Result<RequestResponsePact>
fn as_request_response_pact(&self) -> Result<RequestResponsePact>
Attempt to downcast to a concrete Pact
Sourcefn as_message_pact(&self) -> Result<MessagePact>
fn as_message_pact(&self) -> Result<MessagePact>
Attempt to downcast to a concrete Message Pact
Sourcefn as_v4_pact(&self) -> Result<V4Pact>
fn as_v4_pact(&self) -> Result<V4Pact>
Attempt to downcast to a concrete V4 Pact
Sourcefn specification_version(&self) -> PactSpecification
fn specification_version(&self) -> PactSpecification
Specification version of this Pact
Sourcefn boxed(&self) -> Box<dyn Pact + Send + Sync + RefUnwindSafe>
fn boxed(&self) -> Box<dyn Pact + Send + Sync + RefUnwindSafe>
Clones this Pact and wraps it in a Box
Sourcefn arced(&self) -> Arc<dyn Pact + Send + Sync + RefUnwindSafe>
fn arced(&self) -> Arc<dyn Pact + Send + Sync + RefUnwindSafe>
Clones this Pact and wraps it in an Arc
Sourcefn thread_safe(&self) -> Arc<Mutex<dyn Pact + Send + Sync + RefUnwindSafe>>
fn thread_safe(&self) -> Arc<Mutex<dyn Pact + Send + Sync + RefUnwindSafe>>
Clones this Pact and wraps it in an Arc and Mutex
Sourcefn add_interaction(&mut self, interaction: &dyn Interaction) -> Result<()>
fn add_interaction(&mut self, interaction: &dyn Interaction) -> Result<()>
Adds an interactions in the Pact
Sourcefn requires_plugins(&self) -> bool
fn requires_plugins(&self) -> bool
If this Pact needs any plugins loaded
Sourcefn plugin_data(&self) -> Vec<PluginData>
fn plugin_data(&self) -> Vec<PluginData>
Plugins required for this Pact. These will be taken from the ‘plugins’ key in the pact metadata.
Sourcefn add_plugin(
&mut self,
name: &str,
version: &str,
plugin_data: Option<HashMap<String, Value>>,
) -> Result<()>
fn add_plugin( &mut self, name: &str, version: &str, plugin_data: Option<HashMap<String, Value>>, ) -> Result<()>
Add the plugin and plugin data to this Pact. If an entry already exists for the plugin, the plugin data will be merged
Sourcefn add_md_version(&mut self, key: &str, version: &str)
fn add_md_version(&mut self, key: &str, version: &str)
Adds some version info to the Pact-Rust metadata section