Skip to content

std::mime

Status: experimental

RFC 2045 media type parsing, parameter extraction, and extension lookup.

API details and source

The implementation source contains the complete declarations and implementation notes. The table below lists canonical Gossamer call signatures; every item name links directly to its implementation file.

Item Canonical signature or declaration Description
boundary fn boundary(mime: String) -> String Return the multipart boundary parameter, or empty.
charset fn charset(mime: String) -> String Return the charset parameter, or empty.
extension_by_type fn extension_by_type(mime: String) -> Option<String> Canonical extension (no leading dot) for a media type, or empty.
is_valid fn is_valid(value: String) -> bool Return true iff the string parses as a valid media type.
param fn param(mime: String, name: String) -> Option<String> Return an arbitrary parameter by key, or empty.
parse fn parse(value: String) -> Result<mime::Mime, errors::Error> Canonical type/subtype form of the input, or empty on parse failure.
sub fn sub(mime: String) -> String Subtype (e.g. html) of a media type, or empty.
top fn top(mime: String) -> String Top-level type (e.g. text) of a media type, or empty.
type_by_extension fn type_by_extension(ext: String) -> Option<String> Canonical media type for a filename extension (dot optional), or empty.