use-mime 0.0.1

Small MIME type utilities for RustUse
Documentation
  • Coverage
  • 80%
    12 out of 15 items documented1 out of 12 items with examples
  • Size
  • Source code size: 9.3 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 363.74 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Documentation
  • RustUse/use-web
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

use-mime

Small MIME type utilities for RustUse.

Experimental

use-mime is experimental while the use-web workspace remains below 0.3.0. Expect small API adjustments during the first release wave.

Example

use use_mime::{is_json_mime, mime_from_extension, parse_mime};

let mime = parse_mime("application/ld+json; charset=utf-8").unwrap();

assert_eq!(mime.type_, "application");
assert_eq!(mime.subtype, "ld");
assert_eq!(mime.suffix.as_deref(), Some("json"));
assert_eq!(mime_from_extension("svg"), Some("image/svg+xml"));
assert!(is_json_mime("application/ld+json"));

Scope

  • Lightweight MIME parsing and classification.
  • Small extension and MIME lookup tables for common web assets.
  • Graceful handling for malformed input.

Non-goals

  • Complete IANA MIME coverage.
  • Content sniffing.
  • File parsing.

License

Licensed under either of the following, at your option:

  • Apache License, Version 2.0
  • MIT license