pub struct Mime { /* fields omitted */ }
A parsed mime or media type.
Get the top level media type for this Mime
.
let mime = mime::TEXT_PLAIN;
assert_eq!(mime.type_(), "text");
assert_eq!(mime.type_(), mime::TEXT);
Get the subtype of this Mime
.
let mime = mime::TEXT_PLAIN;
assert_eq!(mime.subtype(), "plain");
assert_eq!(mime.subtype(), mime::PLAIN);
Get an optional +suffix for this Mime
.
let svg = "image/svg+xml".parse::<mime::Mime>().unwrap();
assert_eq!(svg.suffix(), Some(mime::XML));
assert_eq!(svg.suffix().unwrap(), "xml");
assert!(mime::TEXT_PLAIN.suffix().is_none());
Look up a parameter by name.
let mime = mime::TEXT_PLAIN_UTF_8;
assert_eq!(mime.get_param(mime::CHARSET), Some(mime::UTF_8));
assert_eq!(mime.get_param("charset").unwrap(), "utf-8");
assert!(mime.get_param("boundary").is_none());
let mime = "multipart/form-data; boundary=ABCDEFG".parse::<mime::Mime>().unwrap();
assert_eq!(mime.get_param(mime::BOUNDARY).unwrap(), "ABCDEFG");
Returns an iterator over the parameters.
[+]
[+]
[−]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
[−]
This method tests for !=
.
[+]
[−]
This method returns an ordering between self
and other
values if one exists. Read more
[−]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
[−]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
[−]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
[−]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
[+]
[−]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self | 1.21.0 [src] |
[−]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self | 1.21.0 [src] |
[−]
Compares and returns the minimum of two values. Read more
[+]
[+]
[−]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
[−]
This method tests for !=
.
[+]
[−]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
[−]
This method tests for !=
.
[+]
type Err = FromStrError
The associated error which can be returned from parsing.
[−]
Parses a string s
to return a value of this type. Read more
[+]
[+]
[+]