Enum QueryItem
pub enum QueryItem {
Key(Vec<u8>),
Range(Range<Vec<u8>>),
RangeInclusive(RangeInclusive<Vec<u8>>),
RangeFull(RangeFull),
RangeFrom(RangeFrom<Vec<u8>>),
RangeTo(RangeTo<Vec<u8>>),
RangeToInclusive(RangeToInclusive<Vec<u8>>),
RangeAfter(RangeFrom<Vec<u8>>),
RangeAfterTo(Range<Vec<u8>>),
RangeAfterToInclusive(RangeInclusive<Vec<u8>>),
}Expand description
A QueryItem represents a key or a range of keys to be included in a proof.
This enum allows specifying different ways of selecting keys, including exact matches, open-ended ranges, and boundary-based selections.
§Variants:
Key(Vec<u8>)→ A specific key.Range(Range<Vec<u8>>)→ A range of keys (exclusive upper bound).RangeInclusive(RangeInclusive<Vec<u8>>)→ A range of keys (inclusive upper bound).RangeFull(RangeFull)→ A full range, including all keys.RangeFrom(RangeFrom<Vec<u8>>)→ A range starting from a key (inclusive).RangeTo(RangeTo<Vec<u8>>)→ A range up to a key (exclusive).RangeToInclusive(RangeToInclusive<Vec<u8>>)→ A range up to a key (inclusive).RangeAfter(RangeFrom<Vec<u8>>)→ A range starting after a key (exclusive).RangeAfterTo(Range<Vec<u8>>)→ A range between two keys, starting after the lower bound.RangeAfterToInclusive(RangeInclusive<Vec<u8>>)→ A range between two
Variants§
Key(Vec<u8>)
A specific key to be included in the proof.
Range(Range<Vec<u8>>)
A range of keys, excluding the upper bound (start..end).
RangeInclusive(RangeInclusive<Vec<u8>>)
A range of keys, including the upper bound (start..=end).
RangeFull(RangeFull)
Represents a full range, covering all possible keys.
RangeFrom(RangeFrom<Vec<u8>>)
A range starting from a key, inclusive (start..).
RangeTo(RangeTo<Vec<u8>>)
A range up to a key, exclusive (..end).
RangeToInclusive(RangeToInclusive<Vec<u8>>)
A range up to a key, inclusive (..=end).
RangeAfter(RangeFrom<Vec<u8>>)
A range starting after a specific key, exclusive ((key, ∞)).
RangeAfterTo(Range<Vec<u8>>)
A range starting after a key and extending to another key, exclusive.
RangeAfterToInclusive(RangeInclusive<Vec<u8>>)
A range starting after a key and extending to another key, inclusive.
Implementations§
§impl QueryItem
impl QueryItem
pub fn intersect(&self, other: &QueryItem) -> QueryItemIntersectionResult
pub fn intersect(&self, other: &QueryItem) -> QueryItemIntersectionResult
Computes the intersection of two query items, returning the shared region and any leftover portions.
pub fn to_range_set(&self) -> RangeSet
pub fn to_range_set(&self) -> RangeSet
Converts this query item into an owned [RangeSet] for intersection
operations.
pub fn to_range_set_borrowed(&self) -> Option<RangeSetBorrowed<'_>>
pub fn to_range_set_borrowed(&self) -> Option<RangeSetBorrowed<'_>>
Converts this query item into a borrowed [RangeSetBorrowed] for
zero-allocation range checks.
pub fn intersect_many_ordered(
ours: &mut Vec<QueryItem>,
theirs: Vec<QueryItem>,
) -> QueryItemManyIntersectionResult
pub fn intersect_many_ordered( ours: &mut Vec<QueryItem>, theirs: Vec<QueryItem>, ) -> QueryItemManyIntersectionResult
Intersects two ordered sets of query items, returning items in both, ours-only, and theirs-only. Both input vectors must be sorted.
§impl QueryItem
impl QueryItem
pub fn merge(&self, other: &QueryItem) -> QueryItem
pub fn merge(&self, other: &QueryItem) -> QueryItem
Merge two overlapping query items into one that covers both ranges.
pub fn merge_assign(&mut self, other: &QueryItem)
pub fn merge_assign(&mut self, other: &QueryItem)
Merges another QueryItem into this one in-place.
§impl QueryItem
impl QueryItem
pub fn processing_footprint(&self) -> u32
pub fn processing_footprint(&self) -> u32
Returns an approximate byte size of this query item for cost estimation.
pub fn lower_bound(&self) -> (Option<&[u8]>, bool)
pub fn lower_bound(&self) -> (Option<&[u8]>, bool)
Returns the lower bound of this query item as (bound, is_exclusive).
None means the lower bound is unbounded.
pub const fn lower_unbounded(&self) -> bool
pub const fn lower_unbounded(&self) -> bool
Returns true if this query item has no lower bound (extends to -inf).
pub fn upper_bound(&self) -> (Option<&[u8]>, bool)
pub fn upper_bound(&self) -> (Option<&[u8]>, bool)
Returns the upper bound of this query item as (bound, is_inclusive).
None means the upper bound is unbounded.
pub const fn upper_unbounded(&self) -> bool
pub const fn upper_unbounded(&self) -> bool
Returns true if this query item has no upper bound (extends to +inf).
pub fn contains(&self, key: &[u8]) -> bool
pub fn contains(&self, key: &[u8]) -> bool
Returns true if the given key falls within this query item’s bounds.
pub fn enum_value(&self) -> u32
pub fn enum_value(&self) -> u32
Returns a numeric discriminant for this query item variant.
pub const fn is_range(&self) -> bool
pub const fn is_range(&self) -> bool
Returns true if this query item is any kind of range (not a single
key).
pub const fn is_unbounded_range(&self) -> bool
pub const fn is_unbounded_range(&self) -> bool
Returns true if this query item is a range with at least one unbounded
end (e.g., RangeFull, RangeFrom, RangeTo, etc.).
pub fn keys(&self) -> Result<Vec<Vec<u8>>, Error>
pub fn keys(&self) -> Result<Vec<Vec<u8>>, Error>
Enumerates all distinct keys in this query item. Only works for Key,
Range, and RangeInclusive with single-byte boundaries; returns an
error for unbounded ranges.
pub fn keys_consume(self) -> Result<Vec<Vec<u8>>, Error>
pub fn keys_consume(self) -> Result<Vec<Vec<u8>>, Error>
Like keys but consumes self, avoiding clones.
pub fn seek_for_iter<I>(
&self,
iter: &mut I,
left_to_right: bool,
) -> CostContext<()>where
I: RawIterator,
pub fn seek_for_iter<I>(
&self,
iter: &mut I,
left_to_right: bool,
) -> CostContext<()>where
I: RawIterator,
Positions a storage iterator to the start of this query item, seeking
forward or backward based on left_to_right.
pub fn iter_is_valid_for_type<I>(
&self,
iter: &I,
limit: Option<u16>,
aggregate_limit: Option<i64>,
left_to_right: bool,
) -> CostContext<bool>where
I: RawIterator,
pub fn iter_is_valid_for_type<I>(
&self,
iter: &I,
limit: Option<u16>,
aggregate_limit: Option<i64>,
left_to_right: bool,
) -> CostContext<bool>where
I: RawIterator,
Returns true if the iterator is currently positioned at a valid key
within this query item’s bounds, respecting direction and limit.
pub fn collides_with(&self, other: &QueryItem) -> bool
pub fn collides_with(&self, other: &QueryItem) -> bool
Returns true if this query item overlaps with other in any way.
Trait Implementations§
§impl<'de, Context> BorrowDecode<'de, Context> for QueryItem
impl<'de, Context> BorrowDecode<'de, Context> for QueryItem
§fn borrow_decode<D>(decoder: &mut D) -> Result<QueryItem, DecodeError>where
D: BorrowDecoder<'de, Context = Context>,
fn borrow_decode<D>(decoder: &mut D) -> Result<QueryItem, DecodeError>where
D: BorrowDecoder<'de, Context = Context>,
§impl Ord for QueryItem
impl Ord for QueryItem
§impl PartialOrd<&[u8]> for QueryItem
impl PartialOrd<&[u8]> for QueryItem
§impl PartialOrd for QueryItem
impl PartialOrd for QueryItem
impl Eq for QueryItem
impl StructuralPartialEq for QueryItem
Auto Trait Implementations§
impl Freeze for QueryItem
impl RefUnwindSafe for QueryItem
impl Send for QueryItem
impl Sync for QueryItem
impl Unpin for QueryItem
impl UnwindSafe for QueryItem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> CostsExt for T
impl<T> CostsExt for T
§fn wrap_with_cost(self, cost: OperationCost) -> CostContext<Self>where
Self: Sized,
fn wrap_with_cost(self, cost: OperationCost) -> CostContext<Self>where
Self: Sized,
CostContext object with provided costs.§fn wrap_fn_cost(
self,
f: impl FnOnce(&Self) -> OperationCost,
) -> CostContext<Self>where
Self: Sized,
fn wrap_fn_cost(
self,
f: impl FnOnce(&Self) -> OperationCost,
) -> CostContext<Self>where
Self: Sized,
CostContext object with costs computed using the
value getting wrapped.Source§impl<'de, T> DefaultBorrowDecode<'de> for Twhere
T: BorrowDecode<'de, ()>,
impl<'de, T> DefaultBorrowDecode<'de> for Twhere
T: BorrowDecode<'de, ()>,
fn borrow_decode<D>(decoder: &mut D) -> Result<Self, DecodeError>
Source§impl<T> DefaultDecode for T
impl<T> DefaultDecode for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T, U> IntoOnNetwork<U> for Twhere
U: FromOnNetwork<T>,
impl<T, U> IntoOnNetwork<U> for Twhere
U: FromOnNetwork<T>,
§fn into_on_network(self, network: Network) -> U
fn into_on_network(self, network: Network) -> U
Calls U::from_on_network(self).
Source§impl<T, U> IntoPlatformVersioned<U> for Twhere
U: FromPlatformVersioned<T>,
impl<T, U> IntoPlatformVersioned<U> for Twhere
U: FromPlatformVersioned<T>,
Source§fn into_platform_versioned(self, platform_version: &PlatformVersion) -> U
fn into_platform_versioned(self, platform_version: &PlatformVersion) -> U
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.