diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/main.rs | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/tests/main.rs b/tests/main.rs index 512aa84..4a81792 100644 --- a/tests/main.rs +++ b/tests/main.rs @@ -1,19 +1,20 @@ -extern crate notmuch; extern crate dirs; +extern crate notmuch; use std::sync::Arc; +use notmuch::{Query, QueryExt, Thread, Threads}; use notmuch::{StreamingIterator, StreamingIteratorExt}; -use notmuch::{Threads, Thread, Query, QueryExt}; fn main() { - let mut mail_path = dirs::home_dir().unwrap(); mail_path.push(".mail"); - match notmuch::Database::open(&mail_path.to_str().unwrap().to_string(), notmuch::DatabaseMode::ReadOnly){ + match notmuch::Database::open( + &mail_path.to_str().unwrap().to_string(), + notmuch::DatabaseMode::ReadOnly, + ) { Ok(db) => { - #[cfg(feature = "v0_21")] { let rev = db.revision(); @@ -25,23 +26,20 @@ fn main() { notmuch::Query::create(dbr.clone(), &"".to_string()).unwrap() }; - // let mut threads = query.search_threads().unwrap(); - - // let mut threads = db.create_query(&"".to_string()).unwrap().search_threads().unwrap(); let threads = Arc::new(<Query as QueryExt>::search_threads(query).unwrap()); - - while let Some(thread) = <Threads<Query> as StreamingIteratorExt<Thread<Threads<Query>>>>::next(threads.clone()) { + while let Some(thread) = <Threads<Query> as StreamingIteratorExt< + Thread<Threads<Query>>, + >>::next(threads.clone()) + { println!("thread {:?} {:?}", thread.subject(), thread.authors()); } - - - }, - Err(err) =>{ + } + Err(err) => { println!("Got error while trying to open db: {:?}", err); } } |
