[][src]Struct media_type::MediaType

pub struct MediaType<S: Spec> { /* fields omitted */ }

Methods

impl<S> MediaType<S> where
    S: Spec
[src]

pub fn parse(input: &str) -> Result<Self, ParserErrorRef>[src]

pub fn validate(input: &str) -> bool[src]

pub fn new<T, ST>(type_: T, subtype: ST) -> Result<Self, Error> where
    T: AsRef<str>,
    ST: AsRef<str>, 
[src]

pub fn new_with_params<T, ST, PI, IN, IV>(
    type_: T,
    subtype: ST,
    params: PI
) -> Result<Self, Error> where
    T: AsRef<str>,
    ST: AsRef<str>,
    PI: IntoIterator<Item = (IN, IV)>,
    IN: AsRef<str>,
    IV: AsRef<str>, 
[src]

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

removes the first param equal to name, returns true if a parameter was returned

If PartialEq is implemented as excepted at only up to one parameter names can match the given name, through even if more would match the function removes the first match and returns.

If no parameter matches name nothing is changed and false is returned.

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

set a given parameter to a give value, overriding the old parameter

If there already exists a parameter with the same name the parameter is overridden.

If there the parameter is not part of the media type it is added.

Note that parameters are order-independent given rfc2045, as such the order parameters will have after this function was used is implementation dependent and can change. Mainly this means that this function could replace the parameter in place or could remove it and add the new parameter the end or insert it in the beginning.

Methods from Deref<Target = AnyMediaType>

pub fn type_(&self) -> Name[src]

pub fn subtype(&self) -> Name[src]

pub fn full_type(&self) -> Name[src]

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

Important traits for Params<'a>
pub fn params(&self) -> Params[src]

pub fn as_str_repr(&self) -> &str[src]

pub fn has_utf8_charset(&self) -> bool[src]

pub fn is_multipart(&self) -> bool[src]

Trait Implementations

impl<S> Into<AnyMediaType> for MediaType<S> where
    S: Spec
[src]

impl From<MediaType<MimeSpec<Ascii, Obs>>> for MediaType<MimeSpec<Internationalized, Obs>>[src]

impl From<MediaType<MimeSpec<Ascii, Modern>>> for MediaType<MimeSpec<Ascii, Obs>>[src]

impl From<MediaType<MimeSpec<Ascii, Modern>>> for MediaType<MimeSpec<Internationalized, Obs>>[src]

impl From<MediaType<MimeSpec<Ascii, Modern>>> for MediaType<MimeSpec<Internationalized, Modern>>[src]

impl From<MediaType<MimeSpec<Internationalized, Modern>>> for MediaType<MimeSpec<Internationalized, Obs>>[src]

impl From<MediaType<HttpSpec<Modern>>> for MediaType<HttpSpec<Obs>>[src]

impl From<MediaType<StrictSpec>> for MediaType<HttpSpec<Modern>>[src]

impl From<MediaType<StrictSpec>> for MediaType<HttpSpec<Obs>>[src]

impl From<MediaType<StrictSpec>> for MediaType<MimeSpec<Ascii, Obs>>[src]

impl From<MediaType<StrictSpec>> for MediaType<MimeSpec<Ascii, Modern>>[src]

impl From<MediaType<StrictSpec>> for MediaType<MimeSpec<Internationalized, Obs>>[src]

impl From<MediaType<StrictSpec>> for MediaType<MimeSpec<Internationalized, Modern>>[src]

impl From<MediaType<StrictSpec>> for MediaType<AnySpec>[src]

impl From<MediaType<HttpSpec<Modern>>> for MediaType<AnySpec>[src]

impl From<MediaType<HttpSpec<Obs>>> for MediaType<AnySpec>[src]

impl From<MediaType<MimeSpec<Ascii, Obs>>> for MediaType<AnySpec>[src]

impl From<MediaType<MimeSpec<Ascii, Modern>>> for MediaType<AnySpec>[src]

impl From<MediaType<MimeSpec<Internationalized, Obs>>> for MediaType<AnySpec>[src]

impl From<MediaType<MimeSpec<Internationalized, Modern>>> for MediaType<AnySpec>[src]

impl<S: Clone + Spec> Clone for MediaType<S>[src]

impl<S1, S2> PartialEq<MediaType<S2>> for MediaType<S1> where
    S1: Spec,
    S2: Spec
[src]

impl<S> Display for MediaType<S> where
    S: Spec
[src]

impl<S: Debug + Spec> Debug for MediaType<S>[src]

impl<S> Deref for MediaType<S> where
    S: Spec
[src]

type Target = AnyMediaType

The resulting type after dereferencing.

impl<S> DerefMut for MediaType<S> where
    S: Spec
[src]

Auto Trait Implementations

impl<S> Send for MediaType<S> where
    S: Send

impl<S> Sync for MediaType<S> where
    S: Sync

impl<S> Unpin for MediaType<S> where
    S: Unpin

impl<S> UnwindSafe for MediaType<S> where
    S: UnwindSafe

impl<S> RefUnwindSafe for MediaType<S> where
    S: RefUnwindSafe

Blanket Implementations

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

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

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, 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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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