From 6f343b3105eceef728d94ec120bd3320bce27225 Mon Sep 17 00:00:00 2001 From: Dirk Van Haerenborgh Date: Sat, 14 Apr 2018 12:03:16 +0200 Subject: add readme and test --- tests/main.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/main.rs (limited to 'tests/main.rs') diff --git a/tests/main.rs b/tests/main.rs new file mode 100644 index 0000000..a6dd022 --- /dev/null +++ b/tests/main.rs @@ -0,0 +1,20 @@ +extern crate notmuch; + +fn main() { + + let mut mail_path = std::env::home_dir().unwrap(); + mail_path.push(".mail"); + + let db = notmuch::Database::open(&mail_path.to_str().unwrap().to_string(), notmuch::DatabaseMode::ReadOnly).unwrap(); + let query = db.create_query(&"".to_string()).unwrap(); + let mut threads = query.search_threads().unwrap(); + + loop { + match threads.next() { + Some(thread) => { + println!("thread {:?} {:?}", thread.subject(), thread.authors()); + }, + None => { break } + } + } +} -- cgit v1.2.1