mime

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

Library
Cargo
v0.3.17
222 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
44 /100 Fair
Development Activity 0
Maintenance 20
Community 76
Maturity 60
Momentum 20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
68 /100 Good
Architecture 65
Code Quality 70
Innovation 60
Learning Curve 75

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

AI Assistants · Collaboration · Productivity

76,967

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
67
Dependency
Built with
Dart 74%
Rust 24%
Updated 1 weeks ago
TypeScript
67%
MIT

Hoppscotch

Developer Tools

80,529

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
65
Dependency
Built with
TypeScript 67%
Vue 25%
Updated 6 days ago
TypeScript
61%
EPL-2.0

Huly Platform

Collaboration · Project Management · Team Chat

27,797

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
62
Dependency
Built with
TypeScript 61%
Svelte 34%
Updated 6 days ago
Rust
96%
Apache 2.0

InfluxDB

Analytics · Databases

31,758

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
82
Repo Health
76
Technical
72
Dependency
Built with
Rust 96%
Updated 1 weeks ago
Rust
78%
AGPL 3.0

Lemmy

Community · Social Media

14,614

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

View details
89
Repo Health
74
Technical
62
Dependency
Built with
Rust 78%
PLpgSQL 14%
Updated 1 weeks ago
JavaScript
55%
Other

Lokus

Knowledge Management · Note Taking

802

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
JavaScript 55%
HTML 21%
Rust 12%
Updated 1 months ago
Rust
100%
Other

Meilisearch

Search

59,424

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

View details
89
Repo Health
88
Technical
68
Dependency
Built with
Rust 100%
Updated 1 weeks ago
Rust
98%

Stalwart

Collaboration

14,848

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
65
Dependency
Built with
Rust 98%
Updated 5 days ago

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