diff options
Diffstat (limited to 'tests/main.rs')
| -rw-r--r-- | tests/main.rs | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/tests/main.rs b/tests/main.rs index a6dd022..b92bcf7 100644 --- a/tests/main.rs +++ b/tests/main.rs @@ -5,16 +5,23 @@ 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(); + match notmuch::Database::open(&mail_path.to_str().unwrap().to_string(), notmuch::DatabaseMode::ReadOnly){ + Ok(db) => { + 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 } + loop { + match threads.next() { + Some(thread) => { + println!("thread {:?} {:?}", thread.subject(), thread.authors()); + }, + None => { break } + } + } + + }, + Err(err) =>{ + println!("Got error while trying to open db: {:?}", err); } } } |
