mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-27 08:08:15 -05:00
storage: into_iter with self by value (#12115)
This commit is contained in:
@@ -59,19 +59,18 @@ where
|
||||
}
|
||||
|
||||
/// Returns an iterator over the raw key value slices.
|
||||
#[allow(clippy::needless_lifetimes)]
|
||||
pub fn iter_slices<'a>(&'a self) -> IntoIter<'a, K, Cow<'a, [u8]>, Cow<'a, [u8]>> {
|
||||
pub fn iter_slices<'a>(self) -> IntoIter<K, Cow<'a, [u8]>, Cow<'a, [u8]>> {
|
||||
self.into_iter()
|
||||
}
|
||||
|
||||
/// Returns an iterator over database items.
|
||||
#[allow(clippy::should_implement_trait)]
|
||||
pub fn into_iter<Key, Value>(&self) -> IntoIter<'_, K, Key, Value>
|
||||
pub fn into_iter<Key, Value>(self) -> IntoIter<K, Key, Value>
|
||||
where
|
||||
Key: TableObject,
|
||||
Value: TableObject,
|
||||
{
|
||||
IntoIter::new(self.clone(), MDBX_NEXT, MDBX_NEXT)
|
||||
IntoIter::new(self, MDBX_NEXT, MDBX_NEXT)
|
||||
}
|
||||
|
||||
/// Retrieves a key/data pair from the cursor. Depending on the cursor op,
|
||||
@@ -508,7 +507,7 @@ unsafe impl<K> Sync for Cursor<K> where K: TransactionKind {}
|
||||
|
||||
/// An iterator over the key/value pairs in an MDBX database.
|
||||
#[derive(Debug)]
|
||||
pub enum IntoIter<'cur, K, Key, Value>
|
||||
pub enum IntoIter<K, Key, Value>
|
||||
where
|
||||
K: TransactionKind,
|
||||
Key: TableObject,
|
||||
@@ -535,11 +534,11 @@ where
|
||||
/// The next and subsequent operations to perform.
|
||||
next_op: ffi::MDBX_cursor_op,
|
||||
|
||||
_marker: PhantomData<(&'cur (), Key, Value)>,
|
||||
_marker: PhantomData<(Key, Value)>,
|
||||
},
|
||||
}
|
||||
|
||||
impl<K, Key, Value> IntoIter<'_, K, Key, Value>
|
||||
impl<K, Key, Value> IntoIter<K, Key, Value>
|
||||
where
|
||||
K: TransactionKind,
|
||||
Key: TableObject,
|
||||
@@ -547,11 +546,11 @@ where
|
||||
{
|
||||
/// Creates a new iterator backed by the given cursor.
|
||||
fn new(cursor: Cursor<K>, op: ffi::MDBX_cursor_op, next_op: ffi::MDBX_cursor_op) -> Self {
|
||||
IntoIter::Ok { cursor, op, next_op, _marker: Default::default() }
|
||||
Self::Ok { cursor, op, next_op, _marker: Default::default() }
|
||||
}
|
||||
}
|
||||
|
||||
impl<K, Key, Value> Iterator for IntoIter<'_, K, Key, Value>
|
||||
impl<K, Key, Value> Iterator for IntoIter<K, Key, Value>
|
||||
where
|
||||
K: TransactionKind,
|
||||
Key: TableObject,
|
||||
@@ -747,13 +746,13 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'cur, K, Key, Value> Iterator for IterDup<'cur, K, Key, Value>
|
||||
impl<K, Key, Value> Iterator for IterDup<'_, K, Key, Value>
|
||||
where
|
||||
K: TransactionKind,
|
||||
Key: TableObject,
|
||||
Value: TableObject,
|
||||
{
|
||||
type Item = IntoIter<'cur, K, Key, Value>;
|
||||
type Item = IntoIter<K, Key, Value>;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
match self {
|
||||
|
||||
Reference in New Issue
Block a user