Skip to content

Commit b98f444

Browse files
committed
make all table iter types Clone and Debug
1 parent 05a7f94 commit b98f444

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

crates/table/src/table_index/mod.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ macro_rules! table_iter {
7272
$($(#[$vattr:meta])* $var:ident($varty:ty),)*
7373
}) => {
7474
$(#[$wattr])*
75+
#[derive(Clone)]
7576
pub struct $wrapper<'a> {
7677
iter: $base<'a>,
7778
}
@@ -84,8 +85,15 @@ macro_rules! table_iter {
8485
}
8586
}
8687

88+
impl fmt::Debug for $wrapper<'_> {
89+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
90+
let iter = self.clone();
91+
f.debug_list().entries(iter).finish()
92+
}
93+
}
94+
8795
$(#[$battr])*
88-
#[derive(derive_more::From)]
96+
#[derive(Clone, derive_more::From)]
8997
enum $base<'a> {
9098
$($(#[$vattr])* $var($varty)),*
9199
}
@@ -226,12 +234,10 @@ table_iter! {
226234

227235
table_iter! {
228236
/// An iterator over rows matching a range of [`AlgebraicValue`]s on the [`TableIndex`].
229-
#[derive(Clone)]
230237
pub struct TableIndexRangeIter =>
231238
/// A ranged iterator over a [`TypedIndex`], with a specialized key type.
232239
///
233240
/// See module docs for info about specialization.
234-
#[derive(Clone)]
235241
enum TypedIndexRangeIter {
236242
/// The range itself provided was empty.
237243
RangeEmpty(iter::Empty<RowPointer>),
@@ -291,13 +297,6 @@ table_iter! {
291297
}
292298
}
293299

294-
impl fmt::Debug for TableIndexRangeIter<'_> {
295-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
296-
let iter = self.clone();
297-
f.debug_list().entries(iter).finish()
298-
}
299-
}
300-
301300
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, derive_more::From)]
302301
enum BowStr<'a> {
303302
Borrowed(&'a str),

crates/table/src/table_index/unique_btree_index.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ impl<K: KeySize + Ord> UniqueBTreeIndex<K> {
140140
}
141141

142142
/// An iterator over the potential value in a unique index for a given key.
143+
#[derive(Clone)]
143144
pub struct UniquePointIter {
144145
/// The iterator seeking for matching keys in the range.
145146
pub(super) iter: IntoIter<RowPointer>,

0 commit comments

Comments
 (0)