mime

Strongly typed MIME (HTTP Media Type) parsing and construction for Rust

Library
Cargo
v0.3.17
219stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
44/100Fair
Development Activity0
Maintenance20
Community76
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
68/100Good
Architecture65
Code Quality70
Innovation60
Learning Curve75

mime is a small Rust crate that models MIME (HTTP Media Type) values as strong types rather than raw strings, catching malformed content-type values at compile time or parse time instead of deep in a request handler. It is a foundational dependency across the Rust HTTP ecosystem, used by libraries like hyper and actix-web to represent Content-Type and Accept headers without repeated ad-hoc string splitting.

The crate exposes constants for common types (mime::TEXT_PLAIN, mime::APPLICATION_JSON) plus a parser for arbitrary media type strings, letting consumers pattern-match on type/subtype pairs and query parameters (like charset) safely.

What You Get

  • A Mime struct with strongly typed top-level type and subtype accessors
  • Predefined constants for common media types (TEXT_PLAIN, APPLICATION_JSON, IMAGE_PNG, and more)
  • A conformant parser for arbitrary MIME strings per RFC 7231
  • Support for MIME parameters such as charset via get_param
  • Optional serde support for serializing/deserializing Mime values

Common Use Cases

  • Parsing and validating a Content-Type header in an HTTP server or client
  • Building Accept headers or content negotiation logic that matches on type/subtype
  • Storing and comparing file/attachment media types without manual string handling
  • Underpinning higher-level HTTP crates (hyper, actix-web) that need a canonical MIME representation

Under The Hood

Architecture - The crate splits parsing logic into a mime-parse sub-crate consumed by the top-level mime crate, which layers ergonomic constants and accessor methods (type_(), subtype(), get_param()) over the parsed representation, keeping the public surface small (src/lib.rs, src/type_.rs, src/value.rs) while isolating RFC 7231 grammar handling. Tech Stack - Pure Rust with zero required runtime dependencies beyond quoted-string for parameter parsing; an optional serde1 feature adds serde Serialize/Deserialize support and an optional macro feature (via mime-macro and proc-macro-hack) enables compile-time-checked MIME literals; Cargo workspace groups the root crate with mime-macro and mime-parse. Code Quality - Unit tests live alongside implementation in constants.rs, value.rs, type_.rs, macros.rs, and range.rs, exercising parsing edge cases and equality/ordering behavior; the codebase is small (~1,200 lines across core files) and has been stable for years with infrequent but low-risk maintenance commits. API Design - The API favors compile-time constants (mime::TEXT_PLAIN) for the common path and a parse() fallback for arbitrary strings, minimizing boilerplate for typical HTTP header handling; documentation lives on docs.rs with a concise README usage example.

Used by 8 apps in this directory

Dart
74%
AGPL 3.0

AppFlowy

Productivity · Project Management · Collaboration

75,729

The open-source AI workspace that puts your data, your rules — with local LLMs, CRDT collaboration, and full self-hosting built in.

View details
66
Repo Health
81
Technical
66
Dependency
Built with
Dart74%
Rust24%
Updated 1 weeks ago
TypeScript
67%
MIT

Hoppscotch

Developer Tools

80,055

A lightweight, offline-capable API development ecosystem for testing HTTP, GraphQL, WebSocket, MQTT, and SSE endpoints across web, desktop, and CLI.

View details
91
Repo Health
83
Technical
66
Dependency
Built with
TypeScript67%
Vue23%
Updated 3 days ago
TypeScript
61%
EPL-2.0

Huly Platform

Project Management · Team Chat · Collaboration

27,384

Open-source all-in-one workspace that replaces Linear, Jira, Slack, and Notion for product and engineering teams.

View details
90
Repo Health
86
Technical
64
Dependency
Built with
TypeScript61%
Svelte34%
Updated 1 weeks ago
Rust
96%
Apache 2.0

InfluxDB

Databases · Analytics

31,705

Open-source time-series database built for real-time ingest, fast SQL queries, and embedded Python automation — powered by Apache Arrow and Parquet.

View details
86
Repo Health
76
Technical
72
Dependency
Built with
Rust96%
Updated yesterday
Rust
78%
AGPL 3.0

Lemmy

Community · Social Media

14,555

Federated, self-hosted Reddit alternative with full community ownership and no corporate control.

View details
90
Repo Health
74
Technical
63
Dependency
Built with
Rust78%
PLpgSQL14%
Updated yesterday
JavaScript
57%
Other

Lokus

Note Taking · Knowledge Management

774

Local-first note-taking with graph view, canvas & AI plugins—your Markdown files, zero telemetry, blazing-fast Rust performance.

View details
78
Repo Health
75
Technical
65
Dependency
Built with
JavaScript57%
HTML24%
Updated 1 weeks ago
Rust
100%
Other

Meilisearch

Search

59,012

Lightning-fast hybrid search engine with AI-powered semantic and full-text retrieval for modern applications.

View details
90
Repo Health
88
Technical
68
Dependency
Built with
Rust100%
Updated 5 days ago
Rust
98%

Stalwart

Collaboration

14,255

All-in-one secure mail and collaboration server covering IMAP, JMAP, SMTP, CalDAV, CardDAV, and WebDAV in a single memory-safe Rust binary.

View details
89
Repo Health
81
Technical
68
Dependency
Built with
Rust98%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search