diff options
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>>> { |