More implementation

This commit is contained in:
2025-07-18 15:53:38 -07:00
parent 90ac9a1e43
commit 50a4bfcac7
5 changed files with 19 additions and 3 deletions

View File

@@ -754,6 +754,7 @@ pub struct Query {
pub is_notmuch: bool,
pub is_newsreader: bool,
pub is_tantivy: bool,
pub is_snoozed: bool,
pub corpus: Option<Corpus>,
}
@@ -777,6 +778,9 @@ impl fmt::Display for Query {
if self.is_newsreader {
write!(f, "is:news ")?;
}
if self.is_snoozed {
write!(f, "is:snoozed ")?;
}
match self.corpus {
Some(c) => write!(f, "corpus:{c:?}")?,
_ => (),
@@ -833,6 +837,7 @@ impl FromStr for Query {
let mut is_notmuch = false;
let mut is_newsreader = false;
let mut is_tantivy = false;
let mut is_snoozed = false;
let mut corpus = None;
for word in s.split_whitespace() {
if word == "is:unread" {
@@ -872,6 +877,8 @@ impl FromStr for Query {
is_newsreader = true;
} else if word == "is:newsreader" {
is_newsreader = true;
} else if word == "is:snoozed" {
is_snoozed = true;
} else {
remainder.push(word.to_string());
}
@@ -890,6 +897,7 @@ impl FromStr for Query {
is_notmuch,
is_newsreader,
is_tantivy,
is_snoozed,
corpus,
})
}