diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2022-09-18 01:42:45 +0300 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2022-09-19 15:18:25 +0300 |
commit | b87d54ea3f3f077b6330e798263be6a3d33b3b9c (patch) | |
tree | 78ba102ac56477162f14ea526bf5022ae564209a | |
parent | a7a50d3078cb7466ab341ddfc30a80c7b1f8dfdb (diff) | |
download | meli-b87d54ea3f3f077b6330e798263be6a3d33b3b9c.zip |
melib/backends.rs: impl Into<BTreeSet<EnvelopeHash>> for EnvelopeHashBatch
-rw-r--r-- | melib/src/backends.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/melib/src/backends.rs b/melib/src/backends.rs index 855b43a4..c9ad0448 100644 --- a/melib/src/backends.rs +++ b/melib/src/backends.rs @@ -663,6 +663,12 @@ impl std::convert::TryFrom<&[EnvelopeHash]> for EnvelopeHashBatch { } } +impl Into<BTreeSet<EnvelopeHash>> for &EnvelopeHashBatch { + fn into(self) -> BTreeSet<EnvelopeHash> { + self.iter().collect::<BTreeSet<EnvelopeHash>>() + } +} + impl EnvelopeHashBatch { pub fn iter(&self) -> impl std::iter::Iterator<Item = EnvelopeHash> + '_ { std::iter::once(self.first).chain(self.rest.iter().cloned()) @@ -671,6 +677,10 @@ impl EnvelopeHashBatch { pub fn len(&self) -> usize { 1 + self.rest.len() } + + pub fn to_set(&self) -> BTreeSet<EnvelopeHash> { + self.into() + } } #[derive(Default, Clone)] |