Struct media_types::MediaType [] [src]

pub struct MediaType {
    pub type_: Option<Type>,
    pub subtype: Option<(Tree, Cow<'static, str>, Option<Cow<'static, str>>)>,
    pub parameters: HashMap<Cow<'static, str>, Cow<'static, str>>,
}

A Media Type commonly used to describe the contents of a resource.

Fields

The top-level type or None to match all types.

A subtype describing the concrete file format. The first element of the tuple is the registration tree, it describes if they are registered by a standards organization, a vendor, or if they are only for private use. The second tuple element is the subtype, it describes the resource. The last part is the suffix it tells how the file was encoded common values are "xml" and "json".

Media types can contain optional parameters for example for charsets or video codes.

Methods

impl MediaType
[src]

Creates the wildcard media type */*.

Creates a media type with only a concrete type and no subtype like image/*.

Creates a new media type.

Creates a new media type with suffix.

Accesses the tree component of the subtype.

Accesses the sub component of the subtype containing the resource type.

Accesses the suffix of the type.

The boundary parameter is used to separate different blocks of multipart resources.

It is defined in RFC2046 - Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types #5.1. Multipart Media Type.

Sets the charset parameter to the given charset and returns the old value if present.

Sets the charset to UTF-8.

Compares the mime type portion (the media type without parameters) of two media types.

Returns true if the mime type portions differ, strict inverse of eq_mime_portion().

Checks if the media type is an image type.

Implements the MIME Sniffing standard for MIME type groups.

Checks if the media type is an audio or video type.

Implements the MIME Sniffing standard for MIME type groups.

Checks if the media type is a font type.

Implements the MIME Sniffing standard for MIME type groups.

Checks if the media type is a zip based type.

Implements the MIME Sniffing standard for MIME type groups.

Checks if the media type is an archive type.

Implements the MIME Sniffing standard for MIME type groups.

Checks if the media type is an XML type.

Implements the MIME Sniffing standard for MIME type groups.

Checks if the media type is a scriptable type, HTML or PDF.

Implements the MIME Sniffing standard for MIME type groups.

Trait Implementations

impl Clone for MediaType
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for MediaType
[src]

Formats the value using the given formatter.

impl Default for MediaType
[src]

Returns the "default value" for a type. Read more

impl Eq for MediaType
[src]

impl PartialEq for MediaType
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl FromStr for MediaType
[src]

top-level type name / [ tree. ] subtype name [ +suffix ] [ ; parameters ]

The associated error which can be returned from parsing.

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

impl Display for MediaType
[src]

Formats the value using the given formatter. Read more