pub trait Interaction: Debug {
Show 31 methods
// Required methods
fn type_of(&self) -> String;
fn is_request_response(&self) -> bool;
fn as_request_response(&self) -> Option<RequestResponseInteraction>;
fn is_message(&self) -> bool;
fn as_message(&self) -> Option<Message>;
fn id(&self) -> Option<String>;
fn description(&self) -> String;
fn set_id(&mut self, id: Option<String>);
fn set_description(&mut self, description: &str);
fn provider_states(&self) -> Vec<ProviderState>;
fn provider_states_mut(&mut self) -> &mut Vec<ProviderState>;
fn contents(&self) -> OptionalBody;
fn contents_for_verification(&self) -> OptionalBody;
fn content_type(&self) -> Option<ContentType>;
fn is_v4(&self) -> bool;
fn as_v4(
&self,
) -> Option<Box<dyn V4Interaction + Send + Sync + RefUnwindSafe>>;
fn as_v4_mut(&mut self) -> Option<&mut dyn V4Interaction>;
fn as_v4_http(&self) -> Option<SynchronousHttp>;
fn as_v4_async_message(&self) -> Option<AsynchronousMessage>;
fn as_v4_sync_message(&self) -> Option<SynchronousMessage>;
fn as_v4_http_mut(&mut self) -> Option<&mut SynchronousHttp>;
fn as_v4_async_message_mut(&mut self) -> Option<&mut AsynchronousMessage>;
fn as_v4_sync_message_mut(&mut self) -> Option<&mut SynchronousMessage>;
fn boxed(&self) -> Box<dyn Interaction + Send + Sync + RefUnwindSafe>;
fn arced(&self) -> Arc<dyn Interaction + Send + Sync + RefUnwindSafe>;
fn thread_safe(
&self,
) -> Arc<Mutex<dyn Interaction + Send + Sync + RefUnwindSafe>>;
fn matching_rules(&self) -> Option<MatchingRules>;
// Provided methods
fn is_v4_http(&self) -> bool { ... }
fn is_v4_async_message(&self) -> bool { ... }
fn is_v4_sync_message(&self) -> bool { ... }
fn pending(&self) -> bool { ... }
}Expand description
Interaction Trait
Required Methods§
Sourcefn is_request_response(&self) -> bool
fn is_request_response(&self) -> bool
If this is a request/response interaction
Sourcefn as_request_response(&self) -> Option<RequestResponseInteraction>
fn as_request_response(&self) -> Option<RequestResponseInteraction>
Returns the request/response interaction if it is one
Sourcefn is_message(&self) -> bool
fn is_message(&self) -> bool
If this is a message interaction
Sourcefn as_message(&self) -> Option<Message>
fn as_message(&self) -> Option<Message>
Returns the message interaction if it is one
Sourcefn id(&self) -> Option<String>
fn id(&self) -> Option<String>
Interaction ID. This will only be set if the Pact file was fetched from a Pact Broker
Sourcefn description(&self) -> String
fn description(&self) -> String
Description of this interaction. This needs to be unique in the pact file.
Sourcefn set_description(&mut self, description: &str)
fn set_description(&mut self, description: &str)
Set the description of this interaction. This needs to be unique in the pact file.
Sourcefn provider_states(&self) -> Vec<ProviderState>
fn provider_states(&self) -> Vec<ProviderState>
Optional provider states for the interaction.
See <https://docs.pact.io/getting_started/provider_states> for more info on provider states.
Sourcefn provider_states_mut(&mut self) -> &mut Vec<ProviderState>
fn provider_states_mut(&mut self) -> &mut Vec<ProviderState>
Mutable Optional provider states for the interaction.
See <https://docs.pact.io/getting_started/provider_states> for more info on provider states.
Sourcefn contents(&self) -> OptionalBody
👎Deprecated since 0.1.0: Some interactions have multiple contents (like request/response), so it is impossible to know which to return for this method
fn contents(&self) -> OptionalBody
Body of the response or message
Sourcefn contents_for_verification(&self) -> OptionalBody
fn contents_for_verification(&self) -> OptionalBody
The contents of the part to use for verification. For example, with HTTP interactions, this will be the response body
Sourcefn content_type(&self) -> Option<ContentType>
👎Deprecated since 0.1.0: Some interactions have multiple contents (like request/response), so it is impossible to know which to return for this method
fn content_type(&self) -> Option<ContentType>
Determine the content type of the interaction. If a Content-Type header or metadata value is present, the
value of that value will be returned. Otherwise, the contents will be inspected.
Sourcefn as_v4(&self) -> Option<Box<dyn V4Interaction + Send + Sync + RefUnwindSafe>>
fn as_v4(&self) -> Option<Box<dyn V4Interaction + Send + Sync + RefUnwindSafe>>
Returns the interaction in V4 format
Sourcefn as_v4_mut(&mut self) -> Option<&mut dyn V4Interaction>
fn as_v4_mut(&mut self) -> Option<&mut dyn V4Interaction>
Returns a mutable reference for the interaction. If the interaction is not a V4 format,
will return None. The as_v4 method can convert to V4 format (via cloning the data).
Sourcefn as_v4_http(&self) -> Option<SynchronousHttp>
fn as_v4_http(&self) -> Option<SynchronousHttp>
Returns the interaction in V4 format
Sourcefn as_v4_async_message(&self) -> Option<AsynchronousMessage>
fn as_v4_async_message(&self) -> Option<AsynchronousMessage>
Returns the interaction in V4 format
Sourcefn as_v4_sync_message(&self) -> Option<SynchronousMessage>
fn as_v4_sync_message(&self) -> Option<SynchronousMessage>
Returns the interaction in V4 format
Sourcefn as_v4_http_mut(&mut self) -> Option<&mut SynchronousHttp>
fn as_v4_http_mut(&mut self) -> Option<&mut SynchronousHttp>
Returns the interaction in V4 format
Sourcefn as_v4_async_message_mut(&mut self) -> Option<&mut AsynchronousMessage>
fn as_v4_async_message_mut(&mut self) -> Option<&mut AsynchronousMessage>
Returns the interaction in V4 format
Sourcefn as_v4_sync_message_mut(&mut self) -> Option<&mut SynchronousMessage>
fn as_v4_sync_message_mut(&mut self) -> Option<&mut SynchronousMessage>
Returns the interaction in V4 format
Sourcefn boxed(&self) -> Box<dyn Interaction + Send + Sync + RefUnwindSafe>
fn boxed(&self) -> Box<dyn Interaction + Send + Sync + RefUnwindSafe>
Clones this interaction and wraps it in a Box
Sourcefn arced(&self) -> Arc<dyn Interaction + Send + Sync + RefUnwindSafe>
fn arced(&self) -> Arc<dyn Interaction + Send + Sync + RefUnwindSafe>
Clones this interaction and wraps it in an Arc
Sourcefn thread_safe(
&self,
) -> Arc<Mutex<dyn Interaction + Send + Sync + RefUnwindSafe>>
fn thread_safe( &self, ) -> Arc<Mutex<dyn Interaction + Send + Sync + RefUnwindSafe>>
Clones this interaction and wraps it in an Arc and Mutex
Sourcefn matching_rules(&self) -> Option<MatchingRules>
👎Deprecated since 0.2.1: Some interactions have multiple contents (like request/response), so it is impossible to know which to return for this method
fn matching_rules(&self) -> Option<MatchingRules>
Returns the matching rules associated with this interaction (if there are any)
Provided Methods§
Sourcefn is_v4_http(&self) -> bool
fn is_v4_http(&self) -> bool
If the interaction is V4 HTTP
Sourcefn is_v4_async_message(&self) -> bool
fn is_v4_async_message(&self) -> bool
If the interaction is a V4 message
Sourcefn is_v4_sync_message(&self) -> bool
fn is_v4_sync_message(&self) -> bool
If the interaction is a V4 synchronous request/response message