Expand description
Guessing of MIME types by file extension.
Uses a static list of file-extension : MIME type mappings.
// the file doesn't have to exist, it just looks at the path
let guess = mime_guess::from_path("some_file.gif");
assert_eq!(guess.first(), Some(mime::IMAGE_GIF));
§Note: MIME Types Returned Are Not Stable/Guaranteed
The media types returned for a given extension are not considered to be part of the crate’s
stable API and are often updated in patch 
 (x.y.[z + 1]) releases to be as correct as
possible.
Additionally, only the extensions of paths/filenames are inspected in order to guess the MIME type. The file that may or may not reside at that path may or may not be a valid file of the returned MIME type. Be wary of unsafe or un-validated assumptions about file structure or length.
Re-exports§
pub extern crate mime;
Modules§
- impl_ 🔒
 
Structs§
- Iter
 - An iterator over the 
Mimetypes of aMimeGuess. - IterRaw
 - An iterator over the raw media type strings of a 
MimeGuess. - Mime
 - A parsed mime or media type.
 - Mime
Guess  - A “guess” of the MIME/Media Type(s) of an extension or path as one or more
Mimeinstances. 
Functions§
- expect_
mime 🔒 - from_
ext  - Wrapper of 
MimeGuess::from_ext(). - from_
path  - Wrapper of 
MimeGuess::from_path(). - get_
extensions  - Get the extensions for a given top-level and sub-level of a MIME type
(
{toplevel}/{sublevel}). - get_
mime_ extensions  - Get a list of known extensions for a given 
Mime. - get_
mime_ extensions_ str  - Get a list of known extensions for a MIME type string.
 - get_
mime_ type Deprecated  - Get the MIME type associated with a file extension.
 - get_
mime_ type_ opt Deprecated  - Get the MIME type associated with a file extension.
 - get_
mime_ type_ str Deprecated  - Get the MIME type string associated with a file extension. Case-insensitive.
 - guess_
mime_ type Deprecated  - Guess the MIME type of 
pathby its extension (as defined byPath::extension()). - guess_
mime_ type_ opt Deprecated  - Guess the MIME type of 
pathby its extension (as defined byPath::extension()). - mime_
str_ for_ path_ ext Deprecated  - Guess the MIME type string of 
pathby its extension (as defined byPath::extension()). - octet_
stream Deprecated  - Get the MIME type for 
application/octet-stream(generic binary stream)