Skip to content

Commit 7df4a7b

Browse files
committed
Add default impl for Storage::range
1 parent a106547 commit 7df4a7b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/std/src/traits.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,17 @@ pub trait Storage {
6161
/// The bound `start` is inclusive and `end` is exclusive.
6262
/// If `start` is lexicographically greater than or equal to `end`, an empty range is described, mo matter of the order.
6363
#[cfg(feature = "iterator")]
64+
#[allow(unused_variables)]
6465
fn range<'a>(
6566
&'a self,
6667
start: Option<&[u8]>,
6768
end: Option<&[u8]>,
6869
order: Order,
69-
) -> Box<dyn Iterator<Item = Record> + 'a>;
70+
) -> Box<dyn Iterator<Item = Record> + 'a> {
71+
// This default implementation is just to avoid breaking code when enabling the `iterator` feature.
72+
// Any actual `Storage` impl should override this method.
73+
Box::new(std::iter::empty())
74+
}
7075

7176
/// Allows iteration over a set of keys, either forwards or backwards.
7277
///

0 commit comments

Comments
 (0)