Struct pact_models::message::Message[][src]

pub struct Message {
    pub id: Option<String>,
    pub description: String,
    pub provider_states: Vec<ProviderState>,
    pub contents: OptionalBody,
    pub metadata: HashMap<String, Value>,
    pub matching_rules: MatchingRules,
    pub generators: Generators,
}
Expand description

Struct that defines a message.

Fields

id: Option<String>

Interaction ID. This will only be set if the Pact file was fetched from a Pact Broker

description: String

Description of this message interaction. This needs to be unique in the pact file.

provider_states: Vec<ProviderState>

Optional provider state for the interaction. See https://docs.pact.io/getting_started/provider_states for more info on provider states.

contents: OptionalBody

The contents of the message

metadata: HashMap<String, Value>

Metadata associated with this message.

matching_rules: MatchingRules

Matching rules

generators: Generators

Generators

Implementations

Returns a default message

Constructs a Message from the Json struct.

Converts this interaction to a Value struct. note: spec version is preserved for compatibility with the RequestResponsePact interface and for future use

Returns the content type of the message by returning the content type associated with the body, or by looking it up in the message metadata

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Returns the headers of the HTTP part.

Returns the headers of the HTTP part in a mutable form.

Returns the body of the HTTP part.

Returns the matching rules of the HTTP part.

Returns the generators of the HTTP part.

Lookup up the content type for the part

Tries to detect the content type of the body by matching some regular expressions against the first 32 characters. Read more

Determine the content type of the HTTP part. If a Content-Type header is present, the value of that header will be returned. Otherwise, the body will be inspected. Read more

Checks if the HTTP Part has the given header

Checks if the HTTP Part has the given header

If the body is a textual type (non-binary)

Convenience method to add a header

Builds a map of generators from the generators and matching rules

The type of the interaction

If this is a request/response interaction

Returns the request/response interaction if it is one

If this is a message interaction

Returns the message interaction if it is one

Interaction ID. This will only be set if the Pact file was fetched from a Pact Broker

Description of this interaction. This needs to be unique in the pact file.

Optional provider states for the interaction. See https://docs.pact.io/getting_started/provider_states for more info on provider states. Read more

👎 Deprecated since 0.8.14:

Some interactions have multiple contents (like request/response), so it is impossible to know which to return for this method

Body of the response or message

The contents of the part to use for verification. For example, with HTTP interactions, this will be the response body Read more

👎 Deprecated since 0.8.14:

Some interactions have multiple contents (like request/response), so it is impossible to know which to return for this method

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. Read more

If this is a V4 interaction

Returns the interaction in V4 format

Returns the interaction in V4 format

Returns the interaction in V4 format

Returns the interaction in V4 format

Clones this interaction and wraps it in a Box

Clones this interaction and wraps it in an Arc

Clones this interaction and wraps it in an Arc and Mutex

Returns the matching rules associated with this interaction (if there are any)

If this interaction is pending (V4 only)

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Converts self into T using Into<T>. Read more

Converts self into a target type. Read more

Compare self to key and return true if they are equal.

Causes self to use its Binary implementation when Debug-formatted.

Causes self to use its Display implementation when Debug-formatted. Read more

Causes self to use its LowerExp implementation when Debug-formatted. Read more

Causes self to use its LowerHex implementation when Debug-formatted. Read more

Causes self to use its Octal implementation when Debug-formatted.

Causes self to use its Pointer implementation when Debug-formatted. Read more

Causes self to use its UpperExp implementation when Debug-formatted. Read more

Causes self to use its UpperHex implementation when Debug-formatted. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Pipes by value. This is generally the method you want to use. Read more

Borrows self and passes that borrow into the pipe function. Read more

Mutably borrows self and passes that borrow into the pipe function. Read more

Borrows self, then passes self.borrow() into the pipe function. Read more

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more

Borrows self, then passes self.as_ref() into the pipe function.

Mutably borrows self, then passes self.as_mut() into the pipe function. Read more

Borrows self, then passes self.deref() into the pipe function.

Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more

Pipes a value into a function that cannot ordinarily be called in suffix position. Read more

Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more

Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more

Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more

Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more

Pipes a dereference into a function that cannot normally be called in suffix position. Read more

Pipes a mutable dereference into a function that cannot normally be called in suffix position. Read more

Pipes a reference into a function that cannot ordinarily be called in suffix position. Read more

Pipes a mutable reference into a function that cannot ordinarily be called in suffix position. Read more

Immutable access to a value. Read more

Mutable access to a value. Read more

Immutable access to the Borrow<B> of a value. Read more

Mutable access to the BorrowMut<B> of a value. Read more

Immutable access to the AsRef<R> view of a value. Read more

Mutable access to the AsMut<R> view of a value. Read more

Immutable access to the Deref::Target of a value. Read more

Mutable access to the Deref::Target of a value. Read more

Calls .tap() only in debug builds, and is erased in release builds.

Calls .tap_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more

Provides immutable access for inspection. Read more

Calls tap in debug builds, and does nothing in release builds.

Provides mutable access for modification. Read more

Calls tap_mut in debug builds, and does nothing in release builds.

Provides immutable access to the reference for inspection.

Calls tap_ref in debug builds, and does nothing in release builds.

Provides mutable access to the reference for modification.

Calls tap_ref_mut in debug builds, and does nothing in release builds.

Provides immutable access to the borrow for inspection. Read more

Calls tap_borrow in debug builds, and does nothing in release builds.

Provides mutable access to the borrow for modification.

Calls tap_borrow_mut in debug builds, and does nothing in release builds. Read more

Immutably dereferences self for inspection.

Calls tap_deref in debug builds, and does nothing in release builds.

Mutably dereferences self for modification.

Calls tap_deref_mut in debug builds, and does nothing in release builds. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

Attempts to convert self into T using TryInto<T>. Read more

Attempts to convert self into a target type. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.