Trait Pact

Source
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§

Source

fn consumer(&self) -> Consumer

Consumer side of the pact

Source

fn provider(&self) -> Provider

Provider side of the pact

Source

fn interactions( &self, ) -> Vec<Box<dyn Interaction + Send + Sync + RefUnwindSafe>>

Interactions in the Pact

Source

fn interactions_mut(&mut self) -> Vec<&mut (dyn Interaction + Send + Sync)>

Mutable collection of interactions in the Pact

Source

fn metadata(&self) -> BTreeMap<String, BTreeMap<String, String>>

Pact metadata

Source

fn to_json(&self, pact_spec: PactSpecification) -> Result<Value>

Converts this pact to a Value struct.

Source

fn as_request_response_pact(&self) -> Result<RequestResponsePact>

Attempt to downcast to a concrete Pact

Source

fn as_message_pact(&self) -> Result<MessagePact>

Attempt to downcast to a concrete Message Pact

Source

fn as_v4_pact(&self) -> Result<V4Pact>

Attempt to downcast to a concrete V4 Pact

Source

fn specification_version(&self) -> PactSpecification

Specification version of this Pact

Source

fn boxed(&self) -> Box<dyn Pact + Send + Sync + RefUnwindSafe>

Clones this Pact and wraps it in a Box

Source

fn arced(&self) -> Arc<dyn Pact + Send + Sync + RefUnwindSafe>

Clones this Pact and wraps it in an Arc

Source

fn thread_safe(&self) -> Arc<Mutex<dyn Pact + Send + Sync + RefUnwindSafe>>

Clones this Pact and wraps it in an Arc and Mutex

Source

fn add_interaction(&mut self, interaction: &dyn Interaction) -> Result<()>

Adds an interactions in the Pact

Source

fn requires_plugins(&self) -> bool

If this Pact needs any plugins loaded

Source

fn plugin_data(&self) -> Vec<PluginData>

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

Source

fn is_v4(&self) -> bool

If this is a V4 Pact

Source

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

Source

fn add_md_version(&mut self, key: &str, version: &str)

Adds some version info to the Pact-Rust metadata section

Trait Implementations§

Source§

impl Clone for Box<dyn Pact>

Source§

fn clone(&self) -> Self

Returns a copy 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 Default for Box<dyn Pact>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Box<dyn Pact>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Implementors§