Struct pact_models::content_types::ContentType
source · pub struct ContentType {
pub main_type: String,
pub sub_type: String,
pub attributes: BTreeMap<String, String>,
pub suffix: Option<String>,
}
Expand description
Content type of a body
Fields§
§main_type: String
Main content type
sub_type: String
Sub content type
attributes: BTreeMap<String, String>
Content type attributes
suffix: Option<String>
Suffix
Implementations§
source§impl ContentType
impl ContentType
sourcepub fn parse<'a, S: Into<&'a str>>(content_type: S) -> Result<ContentType>
pub fn parse<'a, S: Into<&'a str>>(content_type: S) -> Result<ContentType>
Parses a string into a ContentType
sourcepub fn is_strict_xml(&self) -> bool
pub fn is_strict_xml(&self) -> bool
If it is a XML type (not including ones with suffixes like atom+xml)
sourcepub fn base_type(&self) -> ContentType
pub fn base_type(&self) -> ContentType
Returns the base type with no attributes or suffix
sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
If the content type is the default type
sourcepub fn is_equivalent_to(&self, other: &ContentType) -> bool
pub fn is_equivalent_to(&self, other: &ContentType) -> bool
Equals, ignoring attributes if not present on self
Trait Implementations§
source§impl Clone for ContentType
impl Clone for ContentType
source§fn clone(&self) -> ContentType
fn clone(&self) -> ContentType
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 ContentType
impl Debug for ContentType
source§impl Default for ContentType
impl Default for ContentType
source§impl<'de> Deserialize<'de> for ContentType
impl<'de> Deserialize<'de> for ContentType
source§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
source§impl Display for ContentType
impl Display for ContentType
source§impl From<&Mime> for ContentType
impl From<&Mime> for ContentType
source§impl From<&String> for ContentType
impl From<&String> for ContentType
source§impl From<&str> for ContentType
impl From<&str> for ContentType
source§impl From<Mime> for ContentType
impl From<Mime> for ContentType
source§impl From<String> for ContentType
impl From<String> for ContentType
source§impl FromStr for ContentType
impl FromStr for ContentType
source§impl Hash for ContentType
impl Hash for ContentType
source§impl Into<String> for &ContentType
impl Into<String> for &ContentType
source§impl PartialEq<&str> for ContentType
impl PartialEq<&str> for ContentType
source§impl PartialEq<str> for ContentType
impl PartialEq<str> for ContentType
source§impl PartialEq for ContentType
impl PartialEq for ContentType
source§fn eq(&self, other: &ContentType) -> bool
fn eq(&self, other: &ContentType) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for ContentType
impl Serialize for ContentType
impl Eq for ContentType
impl StructuralPartialEq for ContentType
Auto Trait Implementations§
impl Freeze for ContentType
impl RefUnwindSafe for ContentType
impl Send for ContentType
impl Sync for ContentType
impl Unpin for ContentType
impl UnwindSafe for ContentType
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more