#document #mime #parser #nested #robust #multipart #input

nightly crumble

A robust, minimal library for parsing MIME documents

4 releases

0.10.2 Oct 11, 2020
0.10.1 Oct 4, 2020
0.10.0 Sep 28, 2019
0.9.0 Sep 13, 2019

#17 in #documents

22 downloads per month

GPL-3.0-or-later

1.5MB
891 lines

crumble

A robust, minimal library for parsing mime documents. Supports UTF-8, multipart and nested structures. Will try (usually successfully) to parse noncompliant documents.

Usage

Just add crumble = "0.10.1" to your dependencies. Then, given a String rep of a MIME document, parse with Message::new(&mime).

Documentation: https://docs.rs/crumble/ Crate: https://crates.io/crates/crumble

Notes

  • Only returns a simple "AST". You should wrap this in something e.g. crinkle for it to be useful.
  • Example MIME documents which fail parsing welcome!
  • Mirrored on GitHub, upstream is on sr.ht.

Licence

GPLv3+


lib.rs:

crumble

A robust, minimal library for parsing MIME documents.

Supports UTF-8, multipart documents, and nested documents. crumble assumes input is mostly compliant and tries to parse input as best as possible.

Output is a minimal AST-like structure, with no filtering. This structure should be further processed to produce useful work. See for example crinkle.

Example

use crumble::Message;
let message = load_mime_file(); // Example! The consumer must have some source of documents
let message = Message::new(&message)?; // Handle errors

Dependencies

~3.5–5MB
~86K SLoC