Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default impl for Storage::range #2197

Merged
merged 3 commits into from
Jul 30, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/std/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,17 @@ pub trait Storage {
/// The bound `start` is inclusive and `end` is exclusive.
/// If `start` is lexicographically greater than or equal to `end`, an empty range is described, mo matter of the order.
#[cfg(feature = "iterator")]
webmaster128 marked this conversation as resolved.
Show resolved Hide resolved
#[allow(unused_variables)]
fn range<'a>(
&'a self,
start: Option<&[u8]>,
end: Option<&[u8]>,
order: Order,
) -> Box<dyn Iterator<Item = Record> + 'a>;
) -> Box<dyn Iterator<Item = Record> + 'a> {
// This default implementation is just to avoid breaking code when enabling the `iterator` feature.
// Any actual `Storage` impl should override this method.
unimplemented!("This storage does not support ranging. Make sure to override the `range` method in your `Storage` implementation.")
}

/// Allows iteration over a set of keys, either forwards or backwards.
///
Expand Down
Loading