diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-02-22 11:35:39 +0100 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-02-22 11:35:39 +0100 |
commit | 4d501b6947497d7705c64dcaf093e5e5a09a9235 (patch) | |
tree | 841c86683256802e928bf6ca162b2ee18bb348f1 /src/imap/search.rs | |
parent | de5717a020ed741ef206ebb649bac2cd678572fa (diff) | |
download | aerogramme-4d501b6947497d7705c64dcaf093e5e5a09a9235.tar.gz aerogramme-4d501b6947497d7705c64dcaf093e5e5a09a9235.zip |
Compile streams
Diffstat (limited to 'src/imap/search.rs')
-rw-r--r-- | src/imap/search.rs | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/src/imap/search.rs b/src/imap/search.rs index d06c3bd..4ff70ee 100644 --- a/src/imap/search.rs +++ b/src/imap/search.rs @@ -1,13 +1,12 @@ use std::num::{NonZeroU32, NonZeroU64}; -use anyhow::Result; use imap_codec::imap_types::core::NonEmptyVec; use imap_codec::imap_types::search::{MetadataItemSearch, SearchKey}; use imap_codec::imap_types::sequence::{SeqOrUid, Sequence, SequenceSet}; use crate::imap::index::MailIndex; use crate::imap::mail_view::MailView; -use crate::mail::query::{QueryResult, QueryScope}; +use crate::mail::query::QueryScope; pub enum SeqType { Undefined, @@ -145,22 +144,6 @@ impl<'a> Criteria<'a> { (to_keep, to_fetch) } - pub fn filter_on_query<'b>( - &self, - midx_list: &[&'b MailIndex<'b>], - query_result: &'b Vec<QueryResult>, - ) -> Result<Vec<&'b MailIndex<'b>>> { - Ok(midx_list - .iter() - .zip(query_result.iter()) - .map(|(midx, qr)| MailView::new(qr, midx)) - .collect::<Result<Vec<_>, _>>()? - .into_iter() - .filter(|mail_view| self.is_keep_on_query(mail_view)) - .map(|mail_view| mail_view.in_idx) - .collect()) - } - // ---- /// Here we are doing a partial filtering: we do not have access @@ -213,7 +196,7 @@ impl<'a> Criteria<'a> { /// the email, as body(x) might be false. So we need to check it. But as seqid(x) is true, /// we could simplify the request to just body(x) and truncate the first OR. Today, we are /// not doing that, and thus we reevaluate everything. - fn is_keep_on_query(&self, mail_view: &MailView) -> bool { + pub fn is_keep_on_query(&self, mail_view: &MailView) -> bool { use SearchKey::*; match self.0 { // Combinator logic |