Trait pact_models::pact::Pact [−][src]
pub trait Pact: Debug + ReadWritePact {
Show 18 methods
fn consumer(&self) -> Consumer;
fn provider(&self) -> Provider;
fn interactions(&self) -> Vec<Box<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>;
fn arced(&self) -> Arc<dyn Pact + Send + Sync>;
fn thread_safe(&self) -> Arc<Mutex<dyn Pact + Send + Sync>>;
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
fn interactions(&self) -> Vec<Box<dyn Interaction + Send + Sync>>
fn interactions(&self) -> Vec<Box<dyn Interaction + Send + Sync>>
Interactions in the Pact
fn to_json(&self, pact_spec: PactSpecification) -> Result<Value>
fn to_json(&self, pact_spec: PactSpecification) -> Result<Value>
Converts this pact to a Value
struct.
fn as_request_response_pact(&self) -> Result<RequestResponsePact>
fn as_request_response_pact(&self) -> Result<RequestResponsePact>
Attempt to downcast to a concrete Pact
fn as_message_pact(&self) -> Result<MessagePact>
fn as_message_pact(&self) -> Result<MessagePact>
Attempt to downcast to a concrete Message Pact
fn as_v4_pact(&self) -> Result<V4Pact>
fn as_v4_pact(&self) -> Result<V4Pact>
Attempt to downcast to a concrete V4 Pact
fn specification_version(&self) -> PactSpecification
fn specification_version(&self) -> PactSpecification
Specification version of this Pact
Clones this Pact and wraps it in an Arc and Mutex
fn add_interaction(&mut self, interaction: &dyn Interaction) -> Result<()>
fn add_interaction(&mut self, interaction: &dyn Interaction) -> Result<()>
Adds an interactions in the Pact
fn requires_plugins(&self) -> bool
fn requires_plugins(&self) -> bool
If this Pact needs any plugins loaded
fn 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.
Add the plugin and plugin data to this Pact. If an entry already exists for the plugin, the plugin data will be merged
fn 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