diff options
| -rw-r--r-- | Cargo.lock | 32 | ||||
| -rw-r--r-- | Cargo.toml | 1 | ||||
| -rw-r--r-- | src/main.rs | 4 | 
3 files changed, 37 insertions, 0 deletions
| @@ -1,6 +1,18 @@  # This file is automatically @generated by Cargo.  # It is not intended for manual editing.  [[package]] +name = "ahash" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" + +[[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" + +[[package]]  name = "base64"  version = "0.10.1"  source = "registry+https://github.com/rust-lang/crates.io-index" @@ -47,6 +59,16 @@ dependencies = [  ]  [[package]] +name = "hashbrown" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96282e96bfcd3da0d3aa9938bedf1e50df3269b6db08b4876d2da0bb1a0841cf" +dependencies = [ + "ahash", + "autocfg", +] + +[[package]]  name = "mailparse"  version = "0.13.2"  source = "registry+https://github.com/rust-lang/crates.io-index" @@ -62,6 +84,7 @@ name = "ottolangy"  version = "0.0.1"  dependencies = [   "mailparse", + "whatlang",  ]  [[package]] @@ -69,3 +92,12 @@ name = "quoted_printable"  version = "0.4.2"  source = "registry+https://github.com/rust-lang/crates.io-index"  checksum = "47b080c5db639b292ac79cbd34be0cfc5d36694768d8341109634d90b86930e2" + +[[package]] +name = "whatlang" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "783066160df650d0cc2629fa4f616ef4fcf00817803789e92ca09a55eba6ff05" +dependencies = [ + "hashbrown", +] @@ -5,3 +5,4 @@ edition = "2018"  [dependencies]  mailparse = "0.13.2" +whatlang = "0.11.1" diff --git a/src/main.rs b/src/main.rs index 734e302..433018f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@  use mailparse; +use whatlang;  use std::error::Error;  use std::io::{self, Read}; @@ -12,6 +13,9 @@ fn main() {      let body = get_email_body(&email_input).unwrap();      print!("{}", body); + +    let lang_info = whatlang::detect(&body).unwrap(); +    println!("{:?}", lang_info);  }  fn get_email_body(email: &[u8]) -> Result<String, Box<dyn Error>> { | 
