Enum pact_models::bodies::OptionalBody [−][src]
pub enum OptionalBody {
Missing,
Empty,
Null,
Present(Bytes, Option<ContentType>, Option<ContentTypeHint>),
}
Expand description
Enum that defines the four main states that a body of a request and response can be in a pact file.
Variants
A body is missing if it is not present in the pact file
An empty body that is present in the pact file.
A JSON body that is the null value. This state is to protect other language implementations
from null values. It is treated as Empty
.
Present(Bytes, Option<ContentType>, Option<ContentTypeHint>)
A non-empty body that is present in the pact file.
Tuple Fields of Present
Implementations
If the body is present in the pact file and not empty or null.
Returns the body if present, otherwise returns the empty buffer.
Returns the body if present as a UTF-8 string, otherwise returns the empty string.
If the body has a content type associated to it
Parsed content type of the body
Converts this body into a V4 Pact file JSON format
Set the content type of the body. If the body is missing or empty, this is a no-op.
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for OptionalBody
impl Send for OptionalBody
impl Sync for OptionalBody
impl Unpin for OptionalBody
impl UnwindSafe for OptionalBody
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more