From 500f25a2fe6e1f556665a2918e23bd6ebc3de17d Mon Sep 17 00:00:00 2001 From: Katharina Fey Date: Tue, 7 Jan 2020 17:04:27 +0000 Subject: Adding first outline of libgitmail --- libgitmail/Cargo.toml | 11 +++++++++++ libgitmail/src/lib.rs | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 libgitmail/Cargo.toml create mode 100644 libgitmail/src/lib.rs diff --git a/libgitmail/Cargo.toml b/libgitmail/Cargo.toml new file mode 100644 index 0000000..1a45357 --- /dev/null +++ b/libgitmail/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "libgitmail" +description = "Provide an easy type-safe wrapper around git patch emails" +version = "0.1.0" +authors = ["Katharina Fey "] +edition = "2018" +license = "GPL-3.0" + +[dependencies] +mailparse = "0.10" +nom = "5.0" \ No newline at end of file diff --git a/libgitmail/src/lib.rs b/libgitmail/src/lib.rs new file mode 100644 index 0000000..81de51d --- /dev/null +++ b/libgitmail/src/lib.rs @@ -0,0 +1,20 @@ +//! A library that can parse git-send-email generated email +//! +//! Please note that this is not a general mail parser. It is +//! specifically built to understand mail generated by git-send-email. +//! For a more general mail parser, maybe look at mailparse or mail +//! instead. +//! +//! The important fields to get from a git email are the "In-Reply-To" +//! and "References" header. The `structure` method returns the basic +//! structure of a pathset with a way to select specific parts of the +//! set to export. Look at the `PatchSet` type for more information. + +/// A mail error type +#[derive(Debug)] +pub enum Error { + /// Failed to parse the email for an unknown reason + FailedParsing, + /// The provided email is not a valid get-sent mail + NotAGitMail, +} -- cgit v1.2.3