Skip to content

Commit

Permalink
Impl Clone for Range and ArcRange
Browse files Browse the repository at this point in the history
  • Loading branch information
cberner committed Jan 15, 2024
1 parent 5035fab commit 6e6223b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ impl<
}
}

#[derive(Clone)]
pub struct ArcRange<K: RedbKey + 'static, V: RedbValue + 'static> {
inner: Range<'static, K, V>,
}
Expand All @@ -624,6 +625,7 @@ impl<K: RedbKey + 'static, V: RedbValue + 'static> DoubleEndedIterator for ArcRa
}
}

#[derive(Clone)]
pub struct Range<'a, K: RedbKey + 'static, V: RedbValue + 'static> {
inner: BtreeRangeIter<K, V>,
_transaction_guard: Arc<TransactionGuard>,
Expand Down
3 changes: 2 additions & 1 deletion src/tree_store/btree_iters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -380,6 +380,7 @@ impl<K: RedbKey, V: RedbValue, F: for<'f> FnMut(K::SelfType<'f>, V::SelfType<'f>
}
}

#[derive(Clone)]
pub(crate) struct BtreeRangeIter<K: RedbKey, V: RedbValue> {
left: Option<RangeIterState>, // Exclusive. The previous element returned
right: Option<RangeIterState>, // Exclusive. The previous element returned
Expand Down

0 comments on commit 6e6223b

Please sign in to comment.