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

Consumer side of the pact

Provider side of the pact

Interactions in the Pact

Pact metadata

Converts this pact to a Value struct.

Attempt to downcast to a concrete Pact

Attempt to downcast to a concrete Message Pact

Attempt to downcast to a concrete V4 Pact

Specification version of this Pact

Clones this Pact and wraps it in a Box

Clones this Pact and wraps it in an Arc

Clones this Pact and wraps it in an Arc and Mutex

Adds an interactions in the Pact

If this Pact needs any plugins loaded

Plugins required for this Pact. These will be taken from the ‘plugins’ key in the pact metadata.

If this is a V4 Pact

Add the plugin and plugin data to this Pact. If an entry already exists for the plugin, the plugin data will be merged

Adds some version info to the Pact-Rust metadata section

Implementors