Struct MediaType

Source
pub struct MediaType { /* private fields */ }

Implementations§

Source§

impl MediaType

Source

pub fn parse(media_type: &str) -> Result<MediaType, ComponentCreationError>

Source

pub fn new<T, ST>( type_: T, subtype: ST, ) -> Result<MediaType, ComponentCreationError>
where T: AsRef<str>, ST: AsRef<str>,

Source

pub fn new_with_params<T, ST, I, IV, IN>( type_: T, subtype: ST, params: I, ) -> Result<MediaType, ComponentCreationError>
where T: AsRef<str>, ST: AsRef<str>, I: IntoIterator<Item = (IV, IN)>, IV: AsRef<str>, IN: AsRef<str>,

Source

pub fn remove_param<N>(&mut self, name: N) -> bool
where N: for<'a> PartialEq<Name<'a>>,

Source

pub fn set_param<N, V>(&mut self, name: N, value: V)
where N: AsRef<str>, V: AsRef<str>,

Methods from Deref<Target = AnyMediaType>§

Source

pub fn type_(&self) -> Name<'_>

Source

pub fn subtype(&self) -> Name<'_>

Source

pub fn full_type(&self) -> Name<'_>

Source

pub fn get_param<'a, N>(&'a self, attr: N) -> Option<Value<'a>>
where N: PartialEq<Name<'a>>,

Source

pub fn params(&self) -> Params<'_>

Source

pub fn as_str_repr(&self) -> &str

Source

pub fn has_utf8_charset(&self) -> bool

Source

pub fn is_multipart(&self) -> bool

Trait Implementations§

Source§

impl Clone for MediaType

Source§

fn clone(&self) -> MediaType

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MediaType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Deref for MediaType

Source§

type Target = AnyMediaType

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<MediaType as Deref>::Target

Dereferences the value.
Source§

impl<'de> Deserialize<'de> for MediaType

Source§

fn deserialize<D>( deserializer: D, ) -> Result<MediaType, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl EncodableInHeader for MediaType

Source§

impl From<MediaType<MimeSpec<Ascii, Modern>>> for MediaType

Source§

fn from(media_type: MediaType<MimeSpec<Ascii, Modern>>) -> MediaType

Converts to this type from the input type.
Source§

impl From<MediaType<MimeSpec<Internationalized, Modern>>> for MediaType

Source§

fn from(media_type: MediaType<MimeSpec<Internationalized, Modern>>) -> MediaType

Converts to this type from the input type.
Source§

impl FromStr for MediaType

Source§

type Err = ComponentCreationError

The associated error which can be returned from parsing.
Source§

fn from_str(inp: &str) -> Result<MediaType, <MediaType as FromStr>::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<'a> HeaderTryFrom<&'a str> for MediaType

Source§

impl HeaderTryFrom<MediaType<MimeSpec<Ascii, Modern>>> for MediaType

Source§

impl HeaderTryFrom<MediaType<MimeSpec<Internationalized, Modern>>> for MediaType

Source§

impl Into<AnyMediaType> for MediaType

Source§

fn into(self) -> AnyMediaType

Converts this type into the (usually inferred) input type.
Source§

impl Into<MediaType<MimeSpec<Internationalized, Modern>>> for MediaType

Source§

fn into(self) -> MediaType<MimeSpec<Internationalized, Modern>>

Converts this type into the (usually inferred) input type.
Source§

impl Serialize for MediaType

Source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> HeaderTryFrom<T> for T

Source§

impl<F, T> HeaderTryInto<T> for F
where T: HeaderTryFrom<F>,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

impl<T> Erased for T