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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more