Skip to main content

KeyRangeBuilder

Struct KeyRangeBuilder 

pub struct KeyRangeBuilder { /* private fields */ }
Expand description

Builder produced by crate::Tree::range_keys.

It mirrors RangeBuilder but yields KeyRangeEntry items and deliberately skips value materialisation.

Implementations§

§

impl KeyRangeBuilder

pub fn prefix(self, prefix: &[u8]) -> Self

Restrict the scan to keys starting with prefix. Default: empty (the whole tree).

pub fn start_after(self, key: &[u8]) -> Self

Strict-greater-than lower bound. Default: none (start at the first matching leaf).

pub fn delimiter(self, byte: u8) -> Self

S3-style delimiter byte. When set, leaves whose key (past prefix) contains the delimiter are folded into a single KeyRangeEntry::CommonPrefix emission per distinct common prefix.

pub fn visit<F>(self, limit: usize, visitor: F) -> Result<usize>
where F: FnMut(KeyRangeEntryRef<'_>) -> Result<()>,

Visit key-only range entries with borrowed key bytes.

This has the same ordering, prefix, start-after, delimiter-rollup, and restart semantics as KeyRangeIter, but avoids allocating one Vec<u8> per emitted entry. The slices passed to visitor are valid only for the duration of that callback.

Trait Implementations§

§

impl IntoIterator for KeyRangeBuilder

§

type Item = Result<KeyRangeEntry, Error>

The type of the elements being iterated over.
§

type IntoIter = KeyRangeIter

Which kind of iterator are we turning this into?
§

fn into_iter(self) -> KeyRangeIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.