From abfabf483a23188a1c7005135ee116078e90ef87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Mon, 2 Sep 2024 17:50:26 +0200 Subject: [PATCH] Implement Clone on the bitmap::Iter type --- roaring/src/bitmap/container.rs | 1 + roaring/src/bitmap/iter.rs | 1 + roaring/src/bitmap/store/bitmap_store.rs | 1 + roaring/src/bitmap/store/mod.rs | 1 + 4 files changed, 4 insertions(+) diff --git a/roaring/src/bitmap/container.rs b/roaring/src/bitmap/container.rs index 3ab1e5ad..b72965c5 100644 --- a/roaring/src/bitmap/container.rs +++ b/roaring/src/bitmap/container.rs @@ -17,6 +17,7 @@ pub struct Container { pub store: Store, } +#[derive(Clone)] pub struct Iter<'a> { pub key: u16, inner: store::Iter<'a>, diff --git a/roaring/src/bitmap/iter.rs b/roaring/src/bitmap/iter.rs index 59463a21..f7fe68e6 100644 --- a/roaring/src/bitmap/iter.rs +++ b/roaring/src/bitmap/iter.rs @@ -9,6 +9,7 @@ use crate::{NonSortedIntegers, RoaringBitmap}; use alloc::vec::Vec; /// An iterator for `RoaringBitmap`. +#[derive(Clone)] pub struct Iter<'a> { inner: iter::Flatten>, size_hint: u64, diff --git a/roaring/src/bitmap/store/bitmap_store.rs b/roaring/src/bitmap/store/bitmap_store.rs index f349a2aa..14a97cc7 100644 --- a/roaring/src/bitmap/store/bitmap_store.rs +++ b/roaring/src/bitmap/store/bitmap_store.rs @@ -403,6 +403,7 @@ impl Display for Error { #[cfg(feature = "std")] impl std::error::Error for Error {} +#[derive(Clone)] pub struct BitmapIter> { key: usize, value: u64, diff --git a/roaring/src/bitmap/store/mod.rs b/roaring/src/bitmap/store/mod.rs index bb0d5822..71d981a2 100644 --- a/roaring/src/bitmap/store/mod.rs +++ b/roaring/src/bitmap/store/mod.rs @@ -25,6 +25,7 @@ pub enum Store { Bitmap(BitmapStore), } +#[derive(Clone)] pub enum Iter<'a> { Array(slice::Iter<'a, u16>), Vec(vec::IntoIter),