aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2021-03-09 00:04:06 +0100
committerTeddy Wing2021-03-09 00:04:06 +0100
commitae1335c69ca2aa111b80690c2024e0053609f52e (patch)
treedede78089041394e57609087f202f867762b555e
parente857e893b4cc9dac054189153eba90320722cb4a (diff)
downloadmutt-ottolangy-ae1335c69ca2aa111b80690c2024e0053609f52e.tar.bz2
Testing out different libraries for email parsing
-rw-r--r--Cargo.lock18
-rw-r--r--Cargo.toml4
-rw-r--r--src/main.rs33
3 files changed, 54 insertions, 1 deletions
diff --git a/Cargo.lock b/Cargo.lock
index d1924ce..c1fd4d7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,5 +1,23 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
+name = "buf-read-ext"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bd2b3bef6c7a0f62d42a25a3cce9a40d558f3f4e15b70a7eef4aaea5c2a419ab"
+
+[[package]]
+name = "email-format"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd8eb503420bb8f3576592fed3c40baa2cca5f41420baa9ceef8e1d2c09327bb"
+dependencies = [
+ "buf-read-ext",
+]
+
+[[package]]
name = "ottolangy"
version = "0.0.1"
+dependencies = [
+ "email-format",
+]
diff --git a/Cargo.toml b/Cargo.toml
index 20d7b4a..b589a1f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -4,3 +4,7 @@ version = "0.0.1"
edition = "2018"
[dependencies]
+# email-parser = "0.5.0"
+# mailparse = "0.13.2"
+# email-format = "0.8.0"
+email = "0.0.21"
diff --git a/src/main.rs b/src/main.rs
index e7a11a9..4e3bf83 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,3 +1,34 @@
+// use email_parser::email::Email;
+// use mailparse;
+// use email_format::Email;
+// use email_format::rfc5322::Parsable;
+use email::rfc5322::Rfc5322Parser;
+
+use std::io::{self, Read};
+
+
fn main() {
- println!("Hello, world!");
+ // let mut email_input: Vec<u8> = Vec::with_capacity(2048);
+ let mut email_input: Vec<u8> = Vec::new();
+
+ let mut stdin = io::stdin();
+ stdin.read_to_end(&mut email_input).unwrap();
+
+ // println!("{}", String::from_utf8(email_input).unwrap());
+
+ // email-parser
+ // let email = Email::parse(&email_input).unwrap();
+ // println!("{:?}", email.body);
+
+ // mailparse
+ // let email = mailparse::parse_mail(&email_input).unwrap();
+ // let body = email.get_body().unwrap();
+ // println!("{:?}", body);
+
+ // email-format
+ // let email = Email::parse(&email_input).unwrap().0;
+ // print!("{:?}", email.get_body().unwrap());
+
+ // email
+ let email = Rfc5322Parser::
}