From e9820930abf025de6aa176b3812f24da63c5308b Mon Sep 17 00:00:00 2001 From: Christopher Berner Date: Sat, 13 Jan 2024 08:07:01 -0800 Subject: [PATCH] Impl Clone for Range and ArcRange --- src/table.rs | 2 ++ src/tree_store/btree_iters.rs | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/table.rs b/src/table.rs index e1d67227..ba87f0b4 100644 --- a/src/table.rs +++ b/src/table.rs @@ -606,6 +606,7 @@ impl< } } +#[derive(Clone)] pub struct ArcRange { inner: Range<'static, K, V>, } @@ -624,6 +625,7 @@ impl DoubleEndedIterator for ArcRa } } +#[derive(Clone)] pub struct Range<'a, K: RedbKey + 'static, V: RedbValue + 'static> { inner: BtreeRangeIter, _transaction_guard: Arc, diff --git a/src/tree_store/btree_iters.rs b/src/tree_store/btree_iters.rs index a2b6843b..e1754852 100644 --- a/src/tree_store/btree_iters.rs +++ b/src/tree_store/btree_iters.rs @@ -11,7 +11,7 @@ use std::marker::PhantomData; use std::ops::{Range, RangeBounds}; use std::sync::{Arc, Mutex}; -#[derive(Debug)] +#[derive(Debug, Clone)] pub enum RangeIterState { Leaf { page: PageImpl, @@ -380,6 +380,7 @@ impl FnMut(K::SelfType<'f>, V::SelfType<'f> } } +#[derive(Clone)] pub(crate) struct BtreeRangeIter { left: Option, // Exclusive. The previous element returned right: Option, // Exclusive. The previous element returned