Struct pact_models::v4::message_parts::MessageContents
source · pub struct MessageContents {
pub contents: OptionalBody,
pub metadata: HashMap<String, Value>,
pub matching_rules: MatchingRules,
pub generators: Generators,
}
Expand description
Contents of a message interaction
Fields§
§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§
source§impl MessageContents
impl MessageContents
sourcepub fn from_json(json: &Value) -> Result<MessageContents>
pub fn from_json(json: &Value) -> Result<MessageContents>
Parse the JSON into a MessageContents struct
sourcepub fn message_content_type(&self) -> Option<ContentType>
pub fn message_content_type(&self) -> Option<ContentType>
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
sourcepub fn as_v3_message(&self) -> Message
pub fn as_v3_message(&self) -> Message
Convert this message contents to a V3 asynchronous message
Trait Implementations§
source§impl Clone for MessageContents
impl Clone for MessageContents
source§fn clone(&self) -> MessageContents
fn clone(&self) -> MessageContents
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for MessageContents
impl Debug for MessageContents
source§impl Default for MessageContents
impl Default for MessageContents
source§fn default() -> MessageContents
fn default() -> MessageContents
Returns the “default value” for a type. Read more
source§impl Display for MessageContents
impl Display for MessageContents
source§impl Hash for MessageContents
impl Hash for MessageContents
source§impl HttpPart for MessageContents
impl HttpPart for MessageContents
source§fn headers(&self) -> &Option<HashMap<String, Vec<String>>>
fn headers(&self) -> &Option<HashMap<String, Vec<String>>>
Returns the headers of the HTTP part.
source§fn headers_mut(&mut self) -> &mut HashMap<String, Vec<String>>
fn headers_mut(&mut self) -> &mut HashMap<String, Vec<String>>
Returns the headers of the HTTP part in a mutable form.
source§fn body(&self) -> &OptionalBody
fn body(&self) -> &OptionalBody
Returns the body of the HTTP part.
source§fn body_mut(&mut self) -> &mut OptionalBody
fn body_mut(&mut self) -> &mut OptionalBody
Returns a mutable pointer to the body of the HTTP part.
source§fn matching_rules(&self) -> &MatchingRules
fn matching_rules(&self) -> &MatchingRules
Returns the matching rules of the HTTP part.
source§fn matching_rules_mut(&mut self) -> &mut MatchingRules
fn matching_rules_mut(&mut self) -> &mut MatchingRules
Returns the matching rules of the HTTP part.
source§fn generators(&self) -> &Generators
fn generators(&self) -> &Generators
Returns the generators of the HTTP part.
source§fn generators_mut(&mut self) -> &mut Generators
fn generators_mut(&mut self) -> &mut Generators
Returns the generators of the HTTP part.
source§fn lookup_content_type(&self) -> Option<String>
fn lookup_content_type(&self) -> Option<String>
Lookup up the content type for the part
source§fn detect_content_type(&self) -> Option<ContentType>
fn detect_content_type(&self) -> Option<ContentType>
Tries to detect the content type of the body by matching some regular expressions against
the first 32 characters.
source§fn content_type(&self) -> Option<ContentType>
fn content_type(&self) -> Option<ContentType>
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.source§fn has_header(&self, header_name: &str) -> bool
fn has_header(&self, header_name: &str) -> bool
Checks if the HTTP Part has the given header
source§fn lookup_header_value(&self, header_name: &str) -> Option<String>
fn lookup_header_value(&self, header_name: &str) -> Option<String>
Checks if the HTTP Part has the given header
source§fn has_text_body(&self) -> bool
fn has_text_body(&self) -> bool
If the body is a textual type (non-binary)
source§fn build_generators(
&self,
category: &GeneratorCategory
) -> HashMap<DocPath, Generator>
fn build_generators( &self, category: &GeneratorCategory ) -> HashMap<DocPath, Generator>
Builds a map of generators from the generators and matching rules
source§impl PartialEq for MessageContents
impl PartialEq for MessageContents
impl Eq for MessageContents
Auto Trait Implementations§
impl RefUnwindSafe for MessageContents
impl Send for MessageContents
impl Sync for MessageContents
impl Unpin for MessageContents
impl UnwindSafe for MessageContents
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.