diff options
| author | Teddy Wing | 2021-03-09 00:04:06 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2021-03-09 00:04:06 +0100 | 
| commit | ae1335c69ca2aa111b80690c2024e0053609f52e (patch) | |
| tree | dede78089041394e57609087f202f867762b555e | |
| parent | e857e893b4cc9dac054189153eba90320722cb4a (diff) | |
| download | mutt-ottolangy-ae1335c69ca2aa111b80690c2024e0053609f52e.tar.bz2 | |
Testing out different libraries for email parsing
| -rw-r--r-- | Cargo.lock | 18 | ||||
| -rw-r--r-- | Cargo.toml | 4 | ||||
| -rw-r--r-- | src/main.rs | 33 | 
3 files changed, 54 insertions, 1 deletions
| @@ -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", +] @@ -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::  } | 
