Struct pact_matching::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]

pub fn parse<'a, S: Into<&'a str>>(
    content_type: S
) -> Result<ContentType, String>
[src]

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 Debug for ContentType[src]

impl Default for ContentType[src]

impl<'de> Deserialize<'de> for ContentType[src]

impl Display for ContentType[src]

impl Eq for ContentType[src]

impl From<&'_ String> for ContentType[src]

impl From<&'_ str> for ContentType[src]

impl From<String> for ContentType[src]

impl FromStr for ContentType[src]

type Err = String

The associated error which can be returned from parsing.

impl Hash for ContentType[src]

impl PartialEq<&'_ str> for ContentType[src]

impl PartialEq<ContentType> for ContentType[src]

impl PartialEq<str> for ContentType[src]

impl Serialize for ContentType[src]

impl StructuralEq for ContentType[src]

impl StructuralPartialEq for ContentType[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,