mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-14 20:56:49 +00:00
simplify and improve db iter State init interface
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
1 parent
5bce0a3a46
commit
14341bb906
2 files changed
+12
-25
No files matched your search
+12
-2
@@ -56,20 +56,30 @@ impl<'a> State<'a> {
|
||||
}
|
||||
|
||||
pub(super) fn init_fwd(mut self, from: From<'_>) -> Self {
|
||||
debug_assert!(self.init, "init must be set to make this call");
|
||||
debug_assert!(!self.seek, "seek must not be set to make this call");
|
||||
|
||||
if let Some(key) = from {
|
||||
self.inner.seek(key);
|
||||
self.seek = true;
|
||||
} else {
|
||||
self.inner.seek_to_first();
|
||||
}
|
||||
|
||||
self.seek = true;
|
||||
self
|
||||
}
|
||||
|
||||
pub(super) fn init_rev(mut self, from: From<'_>) -> Self {
|
||||
debug_assert!(self.init, "init must be set to make this call");
|
||||
debug_assert!(!self.seek, "seek must not be set to make this call");
|
||||
|
||||
if let Some(key) = from {
|
||||
self.inner.seek_for_prev(key);
|
||||
self.seek = true;
|
||||
} else {
|
||||
self.inner.seek_to_last();
|
||||
}
|
||||
|
||||
self.seek = true;
|
||||
self
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user