aboutsummaryrefslogtreecommitdiff
path: root/src/uidindex.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2022-06-27 11:40:45 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2022-06-27 11:40:45 +0200
commitd3f8a6627ca13a020bac9936d1f40a18239b6d6d (patch)
treeb08afa6104ca86296b95850b5cedd0fcdf65bf64 /src/uidindex.rs
parent22d0f111734e9fc5c5452e8ce3c452545b76c5d8 (diff)
downloadaerogramme-d3f8a6627ca13a020bac9936d1f40a18239b6d6d.tar.gz
aerogramme-d3f8a6627ca13a020bac9936d1f40a18239b6d6d.zip
Add support for flags
Diffstat (limited to 'src/uidindex.rs')
-rw-r--r--src/uidindex.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/uidindex.rs b/src/uidindex.rs
index 9b85238..d78d8e4 100644
--- a/src/uidindex.rs
+++ b/src/uidindex.rs
@@ -164,6 +164,7 @@ impl BayouState for UidIndex {
// ---- FlagIndex implementation ----
#[derive(Clone)]
pub struct FlagIndex(HashMap<Flag, OrdSet<ImapUid>>);
+pub type FlagIter<'a> = im::hashmap::Keys<'a, Flag, OrdSet<ImapUid>>;
impl FlagIndex {
fn new() -> Self {
@@ -182,9 +183,14 @@ impl FlagIndex {
self.0.get_mut(flag).and_then(|set| set.remove(&uid));
});
}
+
pub fn get(&self, f: &Flag) -> Option<&OrdSet<ImapUid>> {
self.0.get(f)
}
+
+ pub fn flags(&self) -> FlagIter {
+ self.0.keys()
+ }
}
// ---- CUSTOM SERIALIZATION AND DESERIALIZATION ----