aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs
index 2f1f5cc..e4d4a4b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,4 +1,5 @@
use std::io::{Write, stdin, stdout};
+use notmuch::Thread;
use termion::color;
use termion::event::Key;
use termion::input::TermRead;
@@ -17,12 +18,7 @@ fn main() {
// get threads
let query = db.create_query("tag:inbox").unwrap();
- let threads = query.search_threads().unwrap();
- let threads = threads
- .map(|t| format!("thread {:?}, {:?}",
- t.subject(),
- t.authors()))
- .collect();
+ let threads = query.search_threads().unwrap().collect();
let mut i: isize = 0;
show_threads(&mut screen, &threads, i as usize);
@@ -39,7 +35,7 @@ fn main() {
}
}
-fn show_threads<W: Write>(stdout: &mut W, threads: &Vec<String>, highlight: usize) {
+fn show_threads<W: Write>(stdout: &mut W, threads: &Vec<Thread>, highlight: usize) {
write!(stdout, "{}", termion::clear::All).unwrap();
for (i, thread) in threads.iter().enumerate() {
@@ -48,7 +44,7 @@ fn show_threads<W: Write>(stdout: &mut W, threads: &Vec<String>, highlight: usiz
if highlight {
write!(stdout, "{}", color::Fg(color::Red)).unwrap();
}
- write!(stdout, "{}", thread).unwrap();
+ write!(stdout, "thread {:?}, {:?}", thread.subject(), thread.authors()).unwrap();
if highlight {
write!(stdout, "{}", color::Fg(color::Reset)).unwrap();
}