pub struct EncodedIndexKeyRange {
pub start: Bound<EncodedIndexKey>,
pub end: Bound<EncodedIndexKey>,
}Fields§
§start: Bound<EncodedIndexKey>§end: Bound<EncodedIndexKey>Implementations§
Source§impl EncodedIndexKeyRange
impl EncodedIndexKeyRange
pub fn new(start: Bound<EncodedIndexKey>, end: Bound<EncodedIndexKey>) -> Self
Sourcepub fn start_end(
start: Option<EncodedIndexKey>,
end: Option<EncodedIndexKey>,
) -> Self
pub fn start_end( start: Option<EncodedIndexKey>, end: Option<EncodedIndexKey>, ) -> Self
Constructs a key range from optional start and end index keys.
start: If provided, marks the inclusive lower bound of the range. IfNone, the range is unbounded below.end: If provided, marks the exclusive upper bound of the range. IfNone, the range is unbounded above.
This is useful for creating ranges for index scans.
Sourcepub fn start_end_inclusive(
start: Option<EncodedIndexKey>,
end: Option<EncodedIndexKey>,
) -> Self
pub fn start_end_inclusive( start: Option<EncodedIndexKey>, end: Option<EncodedIndexKey>, ) -> Self
Constructs a key range from optional inclusive start and end index keys.
start: If provided, marks the inclusive lower bound of the range. IfNone, the range is unbounded below.end: If provided, marks the inclusive upper bound of the range. IfNone, the range is unbounded above.
Both bounds are inclusive when provided.
Sourcepub fn prefix(prefix: &[u8]) -> Self
pub fn prefix(prefix: &[u8]) -> Self
Generates a key range for an index key prefix, used for prefix scans.
The exclusive end bound is generated by adding 1 to the value of the last byte. If the last byte(s) is 0xff (so adding 1 would overflow), we instead find the latest non-0xff byte, increment that, and truncate the rest. If all bytes are 0xff, we scan to the end of the range.
Sourcepub fn to_encoded_key_range(&self) -> EncodedKeyRange
pub fn to_encoded_key_range(&self) -> EncodedKeyRange
Converts this EncodedIndexKeyRange to an EncodedKeyRange by converting the bounds. This is useful when you need to use index ranges with storage APIs that expect EncodedKeyRange.
Sourcepub fn from_prefix(key: &EncodedIndexKey) -> Self
pub fn from_prefix(key: &EncodedIndexKey) -> Self
Creates a range from an EncodedIndexKey prefix. This will match all keys that start with the given prefix.
Trait Implementations§
Source§impl Clone for EncodedIndexKeyRange
impl Clone for EncodedIndexKeyRange
Source§fn clone(&self) -> EncodedIndexKeyRange
fn clone(&self) -> EncodedIndexKeyRange
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EncodedIndexKeyRange
impl Debug for EncodedIndexKeyRange
Source§impl From<EncodedIndexKeyRange> for EncodedKeyRange
impl From<EncodedIndexKeyRange> for EncodedKeyRange
Source§fn from(range: EncodedIndexKeyRange) -> Self
fn from(range: EncodedIndexKeyRange) -> Self
Auto Trait Implementations§
impl Freeze for EncodedIndexKeyRange
impl RefUnwindSafe for EncodedIndexKeyRange
impl Send for EncodedIndexKeyRange
impl Sync for EncodedIndexKeyRange
impl Unpin for EncodedIndexKeyRange
impl UnwindSafe for EncodedIndexKeyRange
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)