[−][src]Struct media_type::MediaType
Methods
impl<S> MediaType<S> where
S: Spec, [src]
S: Spec,
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]
T: AsRef<str>,
ST: AsRef<str>,
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]
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>,
pub fn remove_param<N>(&mut self, name: N) -> bool where
N: for<'a> PartialEq<Name<'a>>, [src]
N: for<'a> PartialEq<Name<'a>>,
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]
N: AsRef<str>,
V: AsRef<str>,
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]
N: PartialEq<Name<'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: Clone + Spec> Clone for MediaType<S>[src]
impl<S: Debug + Spec> Debug for MediaType<S>[src]
impl<S> Deref for MediaType<S> where
S: Spec, [src]
S: Spec,
type Target = AnyMediaType
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target[src]
impl<S> DerefMut for MediaType<S> where
S: Spec, [src]
S: Spec,
impl<S> Display for MediaType<S> where
S: Spec, [src]
S: Spec,
impl From<MediaType<HttpSpec<Modern>>> for MediaType<HttpSpec<Obs>>[src]
impl From<MediaType<HttpSpec<Modern>>> for MediaType<AnySpec>[src]
impl From<MediaType<HttpSpec<Obs>>> for MediaType<AnySpec>[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]
fn from(
media_type: MediaType<MimeSpec<Ascii, Modern>>
) -> MediaType<MimeSpec<Internationalized, Obs>>[src]
media_type: MediaType<MimeSpec<Ascii, Modern>>
) -> MediaType<MimeSpec<Internationalized, Obs>>
impl From<MediaType<MimeSpec<Ascii, Modern>>> for MediaType<MimeSpec<Internationalized, Modern>>[src]
fn from(
media_type: MediaType<MimeSpec<Ascii, Modern>>
) -> MediaType<MimeSpec<Internationalized, Modern>>[src]
media_type: MediaType<MimeSpec<Ascii, Modern>>
) -> MediaType<MimeSpec<Internationalized, Modern>>
impl From<MediaType<MimeSpec<Ascii, Modern>>> for MediaType<AnySpec>[src]
impl From<MediaType<MimeSpec<Ascii, Obs>>> for MediaType<MimeSpec<Internationalized, Obs>>[src]
fn from(
media_type: MediaType<MimeSpec<Ascii, Obs>>
) -> MediaType<MimeSpec<Internationalized, Obs>>[src]
media_type: MediaType<MimeSpec<Ascii, Obs>>
) -> MediaType<MimeSpec<Internationalized, Obs>>
impl From<MediaType<MimeSpec<Ascii, Obs>>> for MediaType<AnySpec>[src]
impl From<MediaType<MimeSpec<Internationalized, Modern>>> for MediaType<MimeSpec<Internationalized, Obs>>[src]
fn from(
media_type: MediaType<MimeSpec<Internationalized, Modern>>
) -> MediaType<MimeSpec<Internationalized, Obs>>[src]
media_type: MediaType<MimeSpec<Internationalized, Modern>>
) -> MediaType<MimeSpec<Internationalized, Obs>>
impl From<MediaType<MimeSpec<Internationalized, Modern>>> for MediaType<AnySpec>[src]
impl From<MediaType<MimeSpec<Internationalized, Obs>>> for MediaType<AnySpec>[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]
fn from(
media_type: MediaType<StrictSpec>
) -> MediaType<MimeSpec<Internationalized, Obs>>[src]
media_type: MediaType<StrictSpec>
) -> MediaType<MimeSpec<Internationalized, Obs>>
impl From<MediaType<StrictSpec>> for MediaType<MimeSpec<Internationalized, Modern>>[src]
fn from(
media_type: MediaType<StrictSpec>
) -> MediaType<MimeSpec<Internationalized, Modern>>[src]
media_type: MediaType<StrictSpec>
) -> MediaType<MimeSpec<Internationalized, Modern>>
impl From<MediaType<StrictSpec>> for MediaType<AnySpec>[src]
impl<S> Into<AnyMediaType> for MediaType<S> where
S: Spec, [src]
S: Spec,
fn into(self) -> AnyMediaType[src]
impl<S1, S2> PartialEq<MediaType<S2>> for MediaType<S1> where
S1: Spec,
S2: Spec, [src]
S1: Spec,
S2: Spec,
Auto Trait Implementations
impl<S> RefUnwindSafe for MediaType<S> where
S: RefUnwindSafe,
S: RefUnwindSafe,
impl<S> Send for MediaType<S> where
S: Send,
S: Send,
impl<S> Sync for MediaType<S> where
S: Sync,
S: Sync,
impl<S> Unpin for MediaType<S> where
S: Unpin,
S: Unpin,
impl<S> UnwindSafe for MediaType<S> where
S: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,