Struct pact_models::content_types::ContentType [−][src]
pub struct ContentType { pub main_type: String, pub sub_type: String, pub attributes: BTreeMap<String, String>, pub suffix: Option<String>, }
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
impl ContentType
[src]
impl ContentType
[src]pub fn parse<'a, S: Into<&'a str>>(
content_type: S
) -> Result<ContentType, String>
[src]
content_type: S
) -> Result<ContentType, String>
Parses a string into a ContentType
pub fn is_json(&self) -> bool
[src]
If it is a JSON type
pub fn is_xml(&self) -> bool
[src]
If it is a XML type
pub fn is_strict_xml(&self) -> bool
[src]
If it is a XML type (not including ones with suffixes like atom+xml)
pub fn is_text(&self) -> bool
[src]
If it is a text type
pub fn is_binary(&self) -> bool
[src]
If it is a known binary type
pub fn base_type(&self) -> ContentType
[src]
Returns the base type with no attributes or suffix
pub fn is_unknown(&self) -> bool
[src]
If the content type is the default type
pub fn is_equivalent_to(&self, other: &ContentType) -> bool
[src]
Equals, ignoring attributes if not present on self
Trait Implementations
impl Clone for ContentType
[src]
impl Clone for ContentType
[src]fn clone(&self) -> ContentType
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Default for ContentType
[src]
impl Default for ContentType
[src]impl<'de> Deserialize<'de> for ContentType
[src]
impl<'de> Deserialize<'de> for ContentType
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Eq for ContentType
[src]
impl Eq for ContentType
[src]impl FromStr for ContentType
[src]
impl FromStr for ContentType
[src]impl Hash for ContentType
[src]
impl Hash for ContentType
[src]impl PartialEq<&'_ str> for ContentType
[src]
impl PartialEq<&'_ str> for ContentType
[src]impl PartialEq<ContentType> for ContentType
[src]
impl PartialEq<ContentType> for ContentType
[src]fn eq(&self, other: &ContentType) -> bool
[src]
fn ne(&self, other: &ContentType) -> bool
[src]
impl PartialEq<str> for ContentType
[src]
impl PartialEq<str> for ContentType
[src]impl Serialize for ContentType
[src]
impl Serialize for ContentType
[src]impl StructuralEq for ContentType
[src]
impl StructuralEq for ContentType
[src]impl StructuralPartialEq for ContentType
[src]
impl StructuralPartialEq for ContentType
[src]Auto Trait Implementations
impl RefUnwindSafe for ContentType
impl RefUnwindSafe for ContentType
impl Send for ContentType
impl Send for ContentType
impl Sync for ContentType
impl Sync for ContentType
impl Unpin for ContentType
impl Unpin for ContentType
impl UnwindSafe for ContentType
impl UnwindSafe for ContentType