diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-01-06 18:01:44 +0100 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-01-06 18:01:44 +0100 |
commit | f58904f5bb3dbd429555c406c867f850654843a6 (patch) | |
tree | 9b5d62e88dce84fe33cfe1f87ef7e3fb3e23cc2e /src/mail | |
parent | d495538d55c723d8a088c32327258ce10c555a2e (diff) | |
download | aerogramme-f58904f5bb3dbd429555c406c867f850654843a6.tar.gz aerogramme-f58904f5bb3dbd429555c406c867f850654843a6.zip |
Search can now filter on index data
Diffstat (limited to 'src/mail')
-rw-r--r-- | src/mail/mod.rs | 1 | ||||
-rw-r--r-- | src/mail/query.rs | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/mail/mod.rs b/src/mail/mod.rs index bb2f130..37578b8 100644 --- a/src/mail/mod.rs +++ b/src/mail/mod.rs @@ -1,5 +1,4 @@ use std::convert::TryFrom; -use std::io::Write; pub mod incoming; pub mod mailbox; diff --git a/src/mail/query.rs b/src/mail/query.rs index 8de73e6..91bd6c1 100644 --- a/src/mail/query.rs +++ b/src/mail/query.rs @@ -19,6 +19,15 @@ pub enum QueryScope { Partial, Full, } +impl QueryScope { + pub fn union(&self, other: &QueryScope) -> QueryScope { + match (self, other) { + (QueryScope::Full, _) | (_, QueryScope::Full) => QueryScope::Full, + (QueryScope::Partial, _) | (_, QueryScope::Partial) => QueryScope::Partial, + (QueryScope::Index, QueryScope::Index) => QueryScope::Index, + } + } +} impl<'a, 'b> Query<'a, 'b> { pub async fn fetch(&self) -> Result<Vec<QueryResult<'a>>> { |