Enum Element
pub enum Element {
Show 21 variants
Item(Vec<u8>, Option<Vec<u8>>),
Reference(ReferencePathType, Option<u8>, Option<Vec<u8>>),
Tree(Option<Vec<u8>>, Option<Vec<u8>>),
SumItem(i64, Option<Vec<u8>>),
SumTree(Option<Vec<u8>>, i64, Option<Vec<u8>>),
BigSumTree(Option<Vec<u8>>, i128, Option<Vec<u8>>),
CountTree(Option<Vec<u8>>, u64, Option<Vec<u8>>),
CountSumTree(Option<Vec<u8>>, u64, i64, Option<Vec<u8>>),
ProvableCountTree(Option<Vec<u8>>, u64, Option<Vec<u8>>),
ItemWithSumItem(Vec<u8>, i64, Option<Vec<u8>>),
ProvableCountSumTree(Option<Vec<u8>>, u64, i64, Option<Vec<u8>>),
CommitmentTree(u64, u8, Option<Vec<u8>>),
MmrTree(u64, Option<Vec<u8>>),
BulkAppendTree(u64, u8, Option<Vec<u8>>),
DenseAppendOnlyFixedSizeTree(u16, u8, Option<Vec<u8>>),
NonCounted(Box<Element>),
NotSummed(Box<Element>),
NotCountedOrSummed(Box<Element>),
ReferenceWithSumItem(ReferencePathType, Option<u8>, i64, Option<Vec<u8>>),
ProvableSumTree(Option<Vec<u8>>, i64, Option<Vec<u8>>),
ProvableCountProvableSumTree(Option<Vec<u8>>, u64, i64, Option<Vec<u8>>),
}Expand description
Variants of GroveDB stored entities
ONLY APPEND TO THIS LIST!!! Because of how serialization works.
serde::Deserialize is implemented manually (under the serde feature)
so it can enforce the same wrapper invariants as Element::deserialize:
NonCounted, NotSummed, and NotCountedOrSummed may not nest in any
combination, and the sum-bearing wrappers (NotSummed,
NotCountedOrSummed) may only wrap a sum-tree variant.
serde::Serialize is derived; serialization of valid Element values is
always safe.
Variants§
Item(Vec<u8>, Option<Vec<u8>>)
An ordinary value
Reference(ReferencePathType, Option<u8>, Option<Vec<u8>>)
A reference to an object by its path
Tree(Option<Vec<u8>>, Option<Vec<u8>>)
A subtree, contains the prefixed key representing the root of the subtree.
SumItem(i64, Option<Vec<u8>>)
Signed integer value that can be totaled in a sum tree
SumTree(Option<Vec<u8>>, i64, Option<Vec<u8>>)
Same as Element::Tree but underlying Merk sums value of it’s summable nodes
BigSumTree(Option<Vec<u8>>, i128, Option<Vec<u8>>)
Same as Element::Tree but underlying Merk sums value of it’s summable nodes in big form i128 The big sum tree is valuable if you have a big sum tree of sum trees
CountTree(Option<Vec<u8>>, u64, Option<Vec<u8>>)
Same as Element::Tree but underlying Merk counts value of its countable nodes
CountSumTree(Option<Vec<u8>>, u64, i64, Option<Vec<u8>>)
Combines Element::SumTree and Element::CountTree
ProvableCountTree(Option<Vec<u8>>, u64, Option<Vec<u8>>)
Same as Element::CountTree but includes counts in cryptographic state
ItemWithSumItem(Vec<u8>, i64, Option<Vec<u8>>)
An ordinary value with a sum value
ProvableCountSumTree(Option<Vec<u8>>, u64, i64, Option<Vec<u8>>)
Same as Element::CountSumTree but includes counts in cryptographic state (sum is tracked but NOT included in hash, only count is)
CommitmentTree(u64, u8, Option<Vec<u8>>)
Orchard-style commitment tree: combines a BulkAppendTree (for efficient append-only storage of cmx||encrypted_note payloads with epoch compaction) and a Sinsemilla Frontier (for anchor computation). Items are stored in the data namespace via BulkAppendTree; the frontier is stored in data storage.
Fields: (total_count, chunk_power, flags)
total_count: Number of notes appended so far.chunk_power: Log2 of the chunk size (actual size =1 << chunk_power).flags: Optional per-element metadata.
The Sinsemilla frontier root hash is not stored in the Element; it is persisted in data storage and verified by opening the frontier. The BulkAppendTree state_root flows as the Merk child hash.
MmrTree(u64, Option<Vec<u8>>)
MMR (Merkle Mountain Range) tree: append-only authenticated data structure with zero rotations, O(N) total hashes, sequential I/O.
The MMR root hash is stored as the Merk child hash (not in the Element).
Fields: (mmr_size, flags)
mmr_size: Total number of MMR nodes (internal + leaves).flags: Optional per-element metadata.
BulkAppendTree(u64, u8, Option<Vec<u8>>)
Bulk-append tree: two-level structure with a dense Merkle buffer that compacts into chunk blobs stored in an MMR.
Fields: (total_count, chunk_power, flags)
total_count: Number of items appended so far.chunk_power: Log2 of the chunk size (actual size =1 << chunk_power).flags: Optional per-element metadata.
The state root (blake3(mmr_root || buffer_hash)) flows through the
Merk child hash mechanism (insert_subtree’s subtree_root_hash
parameter).
DenseAppendOnlyFixedSizeTree(u16, u8, Option<Vec<u8>>)
Dense fixed-sized Merkle tree: a complete binary tree of height h with 2^h - 1 positions. Nodes are filled sequentially in level-order (BFS). Root hash flows through the Merk child hash mechanism (insert_subtree’s subtree_root_hash parameter).
Fields: (count, height, flags)
count: Number of values inserted so far.height: Tree height h; the tree has 2^h - 1 positions.flags: Optional per-element metadata.
NonCounted(Box<Element>)
Non-counted wrapper: contains any other Element type and behaves identically to it for storage, hashing, and internal aggregation, but contributes 0 to its parent count tree’s aggregate count when inserted. Sums still propagate to parent sum trees.
May only be inserted into the non-provable count-bearing trees
(CountTree, CountSumTree). ProvableCountTree and
ProvableCountSumTree bind their aggregate count into every node
hash via node_hash_with_count, so a NonCounted child would
commit a cryptographic count that diverges from the actual number
of stored elements; the insert path rejects the wrapper in those
parents.
Invariant: a NonCounted may not wrap another NonCounted. Enforced
at construction and at deserialization.
NotSummed(Box<Element>)
Not-summed wrapper: contains a sum-bearing tree variant (SumTree,
BigSumTree, CountSumTree, ProvableCountSumTree,
ProvableSumTree, ProvableCountProvableSumTree) and behaves
identically to it for storage, hashing, and its own internal sum
aggregate, but contributes 0 to its parent sum tree’s running sum
when inserted. Counts still propagate.
May only be inserted into sum-bearing trees (SumTree, BigSumTree,
CountSumTree, ProvableCountSumTree, ProvableSumTree,
ProvableCountProvableSumTree).
Invariants (enforced at construction, serialization, and deserialization):
- The inner element MUST be one of the six sum-bearing tree variants above.
- A
NotSummedmay not wrap anotherNotSummed, aNonCounted, aNotCountedOrSummed, or any non-tree element.
NotCountedOrSummed(Box<Element>)
Not-counted-or-summed wrapper: contains a sum-bearing tree variant
(SumTree, BigSumTree, CountSumTree, ProvableCountSumTree,
ProvableSumTree, ProvableCountProvableSumTree) and behaves
identically to it for storage, hashing, and its own internal
aggregates, but contributes 0 to BOTH its parent’s running sum AND
the parent’s count when inserted.
May only be inserted into CountSumTree — the only non-provable
count-AND-sum-bearing tree, where suppressing both axes is
meaningful and the parent count is NOT cryptographically committed.
ProvableCountSumTree and ProvableCountProvableSumTree are
rejected for the same reason as in NonCounted: their count
(and, for PCPS, sum) is bound into every node hash, so a
suppressed child would commit cryptographic aggregates that
diverge from the actual element contents. Any other parent
likewise rejects the wrapper at insert.
For SumTree / BigSumTree / ProvableSumTree inners, this wrapper
suppresses the implicit count-of-one a subtree would contribute to a
parent count tree (it stores a sum internally, but counts as a single
element). For CountSumTree / ProvableCountSumTree /
ProvableCountProvableSumTree inners, it suppresses the explicit
count value as well as the sum.
Invariants (enforced at construction, serialization, and deserialization):
- The inner element MUST be one of the six sum-bearing tree variants above.
- A
NotCountedOrSummedmay not wrap any other wrapper or any non-tree element.
ReferenceWithSumItem(ReferencePathType, Option<u8>, i64, Option<Vec<u8>>)
A reference that simultaneously carries an explicit SumValue.
Resolves like Element::Reference on get() / follow_reference()
(hop-limited, cycle-detected, combined value hash) AND contributes
sum_value to any sum-bearing parent tree like Element::SumItem /
Element::ItemWithSumItem. The sum_value is independent of the
resolved target’s value — it is the caller-supplied weight or amount
associated with the link itself.
Use case: ranked / sortable index entries where the key encodes the rank, the reference points to a canonical record elsewhere, and the sum is the entry’s monetary weight that aggregates into the parent’s total.
May be inserted into any parent tree type. In non-sum parents (Tree,
CountTree, ProvableCountTree) the sum_value is silently ignored,
the same rule Element::ItemWithSumItem follows.
Wrapper compatibility:
- May be wrapped in
NonCountedto opt out of count propagation. - May NOT be wrapped in
NotSummedorNotCountedOrSummed— those whitelists accept only the four sum-tree variants, not item-like or reference-like base variants.
ProvableSumTree(Option<Vec<u8>>, i64, Option<Vec<u8>>)
Same as Element::SumTree but includes the per-node sum in the
cryptographic state. This mirrors ProvableCountTree but for sums,
allowing aggregate-sum range queries to be cryptographically verified
by including the sum in each node hash.
Discriminant 19 — appended after the wrapper bytes and the
ReferenceWithSumItem base variant so that the on-disk encoding of
every variant that landed on develop before this PR (including
NotCountedOrSummed = 17 and ReferenceWithSumItem = 18) is
preserved exactly. NotSummedProvableSumTree and
NotCountedOrSummedProvableSumTree keep their hand-assigned twin
slots (0xB1 and 0xC1) because base 19 still doesn’t fit the
prefix | base formula either.
ProvableCountProvableSumTree(Option<Vec<u8>>, u64, i64, Option<Vec<u8>>)
Same as Element::ProvableCountSumTree but BOTH the per-node count
AND the per-node sum are baked into the cryptographic state. Mirrors
ProvableCountTree and ProvableSumTree simultaneously, enabling
both AggregateCountOnRange AND AggregateSumOnRange range queries
to be cryptographically verified against the same tree.
Discriminant 20 — appended after ProvableSumTree. The
NonCounted twin uses the strict 0x80 | base formula at slot 148
(0x94). The NotSummed and NotCountedOrSummed twins are
hand-assigned out of the 0xB0..=0xBF / 0xC0..=0xCF family ranges
because the formula collapses for bases ≥ 16; their slots are 178
(0xB2) and 194 (0xC2) respectively.
Implementations§
§impl Element
impl Element
pub fn empty_tree() -> Element
pub fn empty_tree() -> Element
Set element to default empty tree without flags
pub fn empty_tree_with_flags(flags: Option<Vec<u8>>) -> Element
pub fn empty_tree_with_flags(flags: Option<Vec<u8>>) -> Element
Set element to default empty tree with flags
pub fn empty_sum_tree() -> Element
pub fn empty_sum_tree() -> Element
Set element to default empty sum tree without flags
pub fn empty_big_sum_tree() -> Element
pub fn empty_big_sum_tree() -> Element
Set element to default empty big sum tree without flags
pub fn empty_count_tree() -> Element
pub fn empty_count_tree() -> Element
Set element to default empty count tree without flags
pub fn empty_count_sum_tree() -> Element
pub fn empty_count_sum_tree() -> Element
Set element to default empty count sum tree without flags
pub fn empty_sum_tree_with_flags(flags: Option<Vec<u8>>) -> Element
pub fn empty_sum_tree_with_flags(flags: Option<Vec<u8>>) -> Element
Set element to default empty sum tree with flags
pub fn empty_big_sum_tree_with_flags(flags: Option<Vec<u8>>) -> Element
pub fn empty_big_sum_tree_with_flags(flags: Option<Vec<u8>>) -> Element
Set element to default empty sum tree with flags
pub fn empty_count_tree_with_flags(flags: Option<Vec<u8>>) -> Element
pub fn empty_count_tree_with_flags(flags: Option<Vec<u8>>) -> Element
Set element to default empty count tree with flags
pub fn empty_count_sum_tree_with_flags(flags: Option<Vec<u8>>) -> Element
pub fn empty_count_sum_tree_with_flags(flags: Option<Vec<u8>>) -> Element
Set element to default empty count sum tree with flags
pub fn new_item_with_flags(
item_value: Vec<u8>,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_item_with_flags( item_value: Vec<u8>, flags: Option<Vec<u8>>, ) -> Element
Set element to an item with flags
pub fn new_sum_item(value: i64) -> Element
pub fn new_sum_item(value: i64) -> Element
Set element to a sum item without flags
pub fn new_sum_item_with_flags(value: i64, flags: Option<Vec<u8>>) -> Element
pub fn new_sum_item_with_flags(value: i64, flags: Option<Vec<u8>>) -> Element
Set element to a sum item with flags
pub fn new_item_with_sum_item(item_value: Vec<u8>, sum_value: i64) -> Element
pub fn new_item_with_sum_item(item_value: Vec<u8>, sum_value: i64) -> Element
Set element to an item with sum value (no flags)
pub fn new_item_with_sum_item_with_flags(
item_value: Vec<u8>,
sum_value: i64,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_item_with_sum_item_with_flags( item_value: Vec<u8>, sum_value: i64, flags: Option<Vec<u8>>, ) -> Element
Set element to an item with sum value and flags
pub fn new_reference(reference_path: ReferencePathType) -> Element
pub fn new_reference(reference_path: ReferencePathType) -> Element
Set element to a reference without flags
pub fn new_reference_with_flags(
reference_path: ReferencePathType,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_reference_with_flags( reference_path: ReferencePathType, flags: Option<Vec<u8>>, ) -> Element
Set element to a reference with flags
pub fn new_reference_with_hops(
reference_path: ReferencePathType,
max_reference_hop: Option<u8>,
) -> Element
pub fn new_reference_with_hops( reference_path: ReferencePathType, max_reference_hop: Option<u8>, ) -> Element
Set element to a reference with hops, no flags
pub fn new_reference_with_max_hops_and_flags(
reference_path: ReferencePathType,
max_reference_hop: Option<u8>,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_reference_with_max_hops_and_flags( reference_path: ReferencePathType, max_reference_hop: Option<u8>, flags: Option<Vec<u8>>, ) -> Element
Set element to a reference with max hops and flags
pub fn new_reference_with_sum_item(
reference_path: ReferencePathType,
sum_value: i64,
) -> Element
pub fn new_reference_with_sum_item( reference_path: ReferencePathType, sum_value: i64, ) -> Element
Set element to a reference-with-sum-item without flags or max hops.
sum_value is the explicit weight that propagates to a sum-bearing
parent — independent of whatever the reference resolves to.
pub fn new_reference_with_sum_item_with_flags(
reference_path: ReferencePathType,
sum_value: i64,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_reference_with_sum_item_with_flags( reference_path: ReferencePathType, sum_value: i64, flags: Option<Vec<u8>>, ) -> Element
Set element to a reference-with-sum-item with flags.
pub fn new_reference_with_sum_item_with_hops(
reference_path: ReferencePathType,
max_reference_hop: Option<u8>,
sum_value: i64,
) -> Element
pub fn new_reference_with_sum_item_with_hops( reference_path: ReferencePathType, max_reference_hop: Option<u8>, sum_value: i64, ) -> Element
Set element to a reference-with-sum-item with max hops, no flags.
pub fn new_reference_with_sum_item_with_max_hops_and_flags(
reference_path: ReferencePathType,
max_reference_hop: Option<u8>,
sum_value: i64,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_reference_with_sum_item_with_max_hops_and_flags( reference_path: ReferencePathType, max_reference_hop: Option<u8>, sum_value: i64, flags: Option<Vec<u8>>, ) -> Element
Set element to a reference-with-sum-item with max hops and flags.
pub fn new_tree_with_flags(
maybe_root_key: Option<Vec<u8>>,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_tree_with_flags( maybe_root_key: Option<Vec<u8>>, flags: Option<Vec<u8>>, ) -> Element
Set element to a tree with flags
pub fn new_sum_tree(maybe_root_key: Option<Vec<u8>>) -> Element
pub fn new_sum_tree(maybe_root_key: Option<Vec<u8>>) -> Element
Set element to a sum tree without flags
pub fn new_sum_tree_with_flags(
maybe_root_key: Option<Vec<u8>>,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_sum_tree_with_flags( maybe_root_key: Option<Vec<u8>>, flags: Option<Vec<u8>>, ) -> Element
Set element to a sum tree with flags
pub fn new_sum_tree_with_flags_and_sum_value(
maybe_root_key: Option<Vec<u8>>,
sum_value: i64,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_sum_tree_with_flags_and_sum_value( maybe_root_key: Option<Vec<u8>>, sum_value: i64, flags: Option<Vec<u8>>, ) -> Element
Set element to a sum tree with flags and sum value
pub fn new_big_sum_tree(maybe_root_key: Option<Vec<u8>>) -> Element
pub fn new_big_sum_tree(maybe_root_key: Option<Vec<u8>>) -> Element
Set element to a big sum tree without flags
pub fn new_big_sum_tree_with_flags(
maybe_root_key: Option<Vec<u8>>,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_big_sum_tree_with_flags( maybe_root_key: Option<Vec<u8>>, flags: Option<Vec<u8>>, ) -> Element
Set element to a big sum tree with flags
pub fn new_big_sum_tree_with_flags_and_sum_value(
maybe_root_key: Option<Vec<u8>>,
big_sum_value: i128,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_big_sum_tree_with_flags_and_sum_value( maybe_root_key: Option<Vec<u8>>, big_sum_value: i128, flags: Option<Vec<u8>>, ) -> Element
Set element to a big sum tree with flags and sum value
pub fn new_count_tree(maybe_root_key: Option<Vec<u8>>) -> Element
pub fn new_count_tree(maybe_root_key: Option<Vec<u8>>) -> Element
Set element to a count tree without flags
pub fn new_count_tree_with_flags(
maybe_root_key: Option<Vec<u8>>,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_count_tree_with_flags( maybe_root_key: Option<Vec<u8>>, flags: Option<Vec<u8>>, ) -> Element
Set element to a count tree with flags
pub fn new_count_tree_with_flags_and_count_value(
maybe_root_key: Option<Vec<u8>>,
count_value: u64,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_count_tree_with_flags_and_count_value( maybe_root_key: Option<Vec<u8>>, count_value: u64, flags: Option<Vec<u8>>, ) -> Element
Set element to a count tree with flags and sum value
pub fn new_count_sum_tree(maybe_root_key: Option<Vec<u8>>) -> Element
pub fn new_count_sum_tree(maybe_root_key: Option<Vec<u8>>) -> Element
Set element to a count sum tree without flags
pub fn new_count_sum_tree_with_flags(
maybe_root_key: Option<Vec<u8>>,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_count_sum_tree_with_flags( maybe_root_key: Option<Vec<u8>>, flags: Option<Vec<u8>>, ) -> Element
Set element to a count sum tree with flags
pub fn new_count_sum_tree_with_flags_and_sum_and_count_value(
maybe_root_key: Option<Vec<u8>>,
count_value: u64,
sum_value: i64,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_count_sum_tree_with_flags_and_sum_and_count_value( maybe_root_key: Option<Vec<u8>>, count_value: u64, sum_value: i64, flags: Option<Vec<u8>>, ) -> Element
Set element to a count sum tree with flags and sum value
pub fn empty_provable_count_tree() -> Element
pub fn empty_provable_count_tree() -> Element
Set element to default empty provable count tree without flags
pub fn empty_provable_count_tree_with_flags(flags: Option<Vec<u8>>) -> Element
pub fn empty_provable_count_tree_with_flags(flags: Option<Vec<u8>>) -> Element
Set element to default empty provable count tree with flags
pub fn new_provable_count_tree(maybe_root_key: Option<Vec<u8>>) -> Element
pub fn new_provable_count_tree(maybe_root_key: Option<Vec<u8>>) -> Element
Set element to a provable count tree without flags
pub fn new_provable_count_tree_with_flags(
maybe_root_key: Option<Vec<u8>>,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_provable_count_tree_with_flags( maybe_root_key: Option<Vec<u8>>, flags: Option<Vec<u8>>, ) -> Element
Set element to a provable count tree with flags
pub fn new_provable_count_tree_with_flags_and_count_value(
maybe_root_key: Option<Vec<u8>>,
count_value: u64,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_provable_count_tree_with_flags_and_count_value( maybe_root_key: Option<Vec<u8>>, count_value: u64, flags: Option<Vec<u8>>, ) -> Element
Set element to a provable count tree with flags and count value
pub fn empty_provable_count_sum_tree() -> Element
pub fn empty_provable_count_sum_tree() -> Element
Set element to default empty provable count sum tree without flags
pub fn empty_provable_count_sum_tree_with_flags(
flags: Option<Vec<u8>>,
) -> Element
pub fn empty_provable_count_sum_tree_with_flags( flags: Option<Vec<u8>>, ) -> Element
Set element to default empty provable count sum tree with flags
pub fn new_provable_count_sum_tree(maybe_root_key: Option<Vec<u8>>) -> Element
pub fn new_provable_count_sum_tree(maybe_root_key: Option<Vec<u8>>) -> Element
Set element to a provable count sum tree without flags
pub fn new_provable_count_sum_tree_with_flags(
maybe_root_key: Option<Vec<u8>>,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_provable_count_sum_tree_with_flags( maybe_root_key: Option<Vec<u8>>, flags: Option<Vec<u8>>, ) -> Element
Set element to a provable count sum tree with flags
pub fn new_provable_count_sum_tree_with_flags_and_sum_and_count_value(
maybe_root_key: Option<Vec<u8>>,
count_value: u64,
sum_value: i64,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_provable_count_sum_tree_with_flags_and_sum_and_count_value( maybe_root_key: Option<Vec<u8>>, count_value: u64, sum_value: i64, flags: Option<Vec<u8>>, ) -> Element
Set element to a provable count sum tree with flags, count, and sum value
pub fn empty_provable_sum_tree() -> Element
pub fn empty_provable_sum_tree() -> Element
Set element to default empty provable sum tree without flags.
ProvableSumTree is the sum analogue of ProvableCountTree: it
bakes the per-node sum into the node hash so that aggregate-sum
range queries can be cryptographically verified.
pub fn empty_provable_sum_tree_with_flags(flags: Option<Vec<u8>>) -> Element
pub fn empty_provable_sum_tree_with_flags(flags: Option<Vec<u8>>) -> Element
Set element to default empty provable sum tree with flags.
pub fn new_provable_sum_tree(maybe_root_key: Option<Vec<u8>>) -> Element
pub fn new_provable_sum_tree(maybe_root_key: Option<Vec<u8>>) -> Element
Set element to a provable sum tree without flags.
pub fn new_provable_sum_tree_with_flags(
maybe_root_key: Option<Vec<u8>>,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_provable_sum_tree_with_flags( maybe_root_key: Option<Vec<u8>>, flags: Option<Vec<u8>>, ) -> Element
Set element to a provable sum tree with flags.
pub fn new_provable_sum_tree_with_flags_and_sum_value(
maybe_root_key: Option<Vec<u8>>,
sum_value: i64,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_provable_sum_tree_with_flags_and_sum_value( maybe_root_key: Option<Vec<u8>>, sum_value: i64, flags: Option<Vec<u8>>, ) -> Element
Set element to a provable sum tree with flags and sum value.
pub fn empty_provable_count_provable_sum_tree() -> Element
pub fn empty_provable_count_provable_sum_tree() -> Element
Set element to default empty provable count provable sum tree without flags.
ProvableCountProvableSumTree bakes BOTH the per-node count AND the
per-node sum into the node hash, enabling both
AggregateCountOnRange and AggregateSumOnRange proofs against the
same tree.
pub fn empty_provable_count_provable_sum_tree_with_flags(
flags: Option<Vec<u8>>,
) -> Element
pub fn empty_provable_count_provable_sum_tree_with_flags( flags: Option<Vec<u8>>, ) -> Element
Set element to default empty provable count provable sum tree with flags.
pub fn new_provable_count_provable_sum_tree(
maybe_root_key: Option<Vec<u8>>,
) -> Element
pub fn new_provable_count_provable_sum_tree( maybe_root_key: Option<Vec<u8>>, ) -> Element
Set element to a provable count provable sum tree without flags.
pub fn new_provable_count_provable_sum_tree_with_flags(
maybe_root_key: Option<Vec<u8>>,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_provable_count_provable_sum_tree_with_flags( maybe_root_key: Option<Vec<u8>>, flags: Option<Vec<u8>>, ) -> Element
Set element to a provable count provable sum tree with flags.
pub fn new_provable_count_provable_sum_tree_with_flags_and_sum_and_count_value(
maybe_root_key: Option<Vec<u8>>,
count_value: u64,
sum_value: i64,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_provable_count_provable_sum_tree_with_flags_and_sum_and_count_value( maybe_root_key: Option<Vec<u8>>, count_value: u64, sum_value: i64, flags: Option<Vec<u8>>, ) -> Element
Set element to a provable count provable sum tree with flags, count, and sum value.
pub fn empty_commitment_tree(chunk_power: u8) -> Result<Element, ElementError>
pub fn empty_commitment_tree(chunk_power: u8) -> Result<Element, ElementError>
Set element to an empty commitment tree.
Returns InvalidInput if chunk_power > 31.
pub fn empty_commitment_tree_with_flags(
chunk_power: u8,
flags: Option<Vec<u8>>,
) -> Result<Element, ElementError>
pub fn empty_commitment_tree_with_flags( chunk_power: u8, flags: Option<Vec<u8>>, ) -> Result<Element, ElementError>
Set element to an empty commitment tree with flags.
Returns InvalidInput if chunk_power > 31.
pub fn new_commitment_tree(
total_count: u64,
chunk_power: u8,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_commitment_tree( total_count: u64, chunk_power: u8, flags: Option<Vec<u8>>, ) -> Element
Set element to a commitment tree with all fields
pub fn empty_mmr_tree() -> Element
pub fn empty_mmr_tree() -> Element
Set element to an empty MMR tree
pub fn empty_mmr_tree_with_flags(flags: Option<Vec<u8>>) -> Element
pub fn empty_mmr_tree_with_flags(flags: Option<Vec<u8>>) -> Element
Set element to an empty MMR tree with flags
pub fn new_mmr_tree(mmr_size: u64, flags: Option<Vec<u8>>) -> Element
pub fn new_mmr_tree(mmr_size: u64, flags: Option<Vec<u8>>) -> Element
Set element to an MMR tree with the given size
pub fn empty_bulk_append_tree(chunk_power: u8) -> Result<Element, ElementError>
pub fn empty_bulk_append_tree(chunk_power: u8) -> Result<Element, ElementError>
Set element to an empty bulk append tree without flags.
Returns InvalidInput if chunk_power > 31.
pub fn empty_bulk_append_tree_with_flags(
chunk_power: u8,
flags: Option<Vec<u8>>,
) -> Result<Element, ElementError>
pub fn empty_bulk_append_tree_with_flags( chunk_power: u8, flags: Option<Vec<u8>>, ) -> Result<Element, ElementError>
Set element to an empty bulk append tree with flags.
Returns InvalidInput if chunk_power > 31.
pub fn new_bulk_append_tree(
total_count: u64,
chunk_power: u8,
flags: Option<Vec<u8>>,
) -> Element
pub fn new_bulk_append_tree( total_count: u64, chunk_power: u8, flags: Option<Vec<u8>>, ) -> Element
Set element to a bulk append tree with all fields
pub fn empty_dense_tree(height: u8) -> Element
pub fn empty_dense_tree(height: u8) -> Element
Set element to an empty dense tree without flags
pub fn empty_dense_tree_with_flags(
height: u8,
flags: Option<Vec<u8>>,
) -> Element
pub fn empty_dense_tree_with_flags( height: u8, flags: Option<Vec<u8>>, ) -> Element
Set element to an empty dense tree with flags
pub fn new_dense_tree(count: u16, height: u8, flags: Option<Vec<u8>>) -> Element
pub fn new_dense_tree(count: u16, height: u8, flags: Option<Vec<u8>>) -> Element
Set element to a dense tree with all fields
pub fn new_non_counted(inner: Element) -> Result<Element, ElementError>
pub fn new_non_counted(inner: Element) -> Result<Element, ElementError>
Wrap an element in NonCounted so it contributes 0 to its parent count
tree’s aggregate count when inserted. Sums (if any) still propagate.
Returns InvalidInput if inner is already wrapped in any wrapper
variant (NonCounted, NotSummed, or NotCountedOrSummed) — the
wrappers are mutually exclusive and may not nest in either direction.
Use into_non_counted to wrap idempotently when inner may already
be NonCounted; use that helper’s Result return for the
cross-wrapper case.
Note: at insert time the parent must be CountTree or
CountSumTree (the non-provable count-bearing variants). Provable
count parents reject the wrapper at the merk-layer insert guard.
pub fn into_non_counted(self) -> Result<Element, ElementError>
pub fn into_non_counted(self) -> Result<Element, ElementError>
Wrap self in NonCounted. If self is already NonCounted,
returns it unchanged (idempotent on NonCounted).
Returns InvalidInput if self is any other wrapper variant — the
wrappers are mutually exclusive. Callers that need the unconditional
wrapping path should ensure the input is a non-wrapper variant
before calling.
pub fn new_not_summed(inner: Element) -> Result<Element, ElementError>
pub fn new_not_summed(inner: Element) -> Result<Element, ElementError>
Wrap a sum-tree variant in NotSummed so it contributes 0 to its
parent sum tree’s running sum when inserted. Counts (if any) still
propagate.
Only the six sum-bearing tree variants are accepted: SumTree,
BigSumTree, CountSumTree, ProvableCountSumTree,
ProvableSumTree, ProvableCountProvableSumTree. Any other
element — including items, sum items, references, non-sum trees, and
any wrapper (NonCounted, NotSummed, NotCountedOrSummed) — is
rejected with InvalidInput.
pub fn into_not_summed(self) -> Result<Element, ElementError>
pub fn into_not_summed(self) -> Result<Element, ElementError>
Wrap self in NotSummed. If self is already NotSummed, returns
it unchanged (idempotent on NotSummed).
Returns InvalidInput if self is any other wrapper (the three
wrappers are mutually exclusive) or any non-sum-tree variant.
Mirrors Element::into_non_counted.
pub fn new_not_counted_or_summed(
inner: Element,
) -> Result<Element, ElementError>
pub fn new_not_counted_or_summed( inner: Element, ) -> Result<Element, ElementError>
Wrap a sum-tree variant in NotCountedOrSummed so it contributes 0
to BOTH its parent’s running sum AND its parent’s count when
inserted.
Only the six sum-bearing tree variants are accepted: SumTree,
BigSumTree, CountSumTree, ProvableCountSumTree,
ProvableSumTree, ProvableCountProvableSumTree. Any other
element — including items, sum items, references, non-sum trees, and
any wrapper (NonCounted, NotSummed, NotCountedOrSummed) — is
rejected with InvalidInput.
Note: at insert time the parent must be CountSumTree. Provable
count-and-sum parents (ProvableCountSumTree,
ProvableCountProvableSumTree) reject the wrapper at the
merk-layer insert guard — they cryptographically commit the
count (and, for PCPS, the sum) into every node hash and must
reflect actual contents.
pub fn into_not_counted_or_summed(self) -> Result<Element, ElementError>
pub fn into_not_counted_or_summed(self) -> Result<Element, ElementError>
Wrap self in NotCountedOrSummed. If self is already
NotCountedOrSummed, returns it unchanged (idempotent).
Returns InvalidInput if self is any other wrapper (the three
wrappers are mutually exclusive) or any non-sum-tree variant.
§impl Element
impl Element
pub fn is_non_counted(&self) -> bool
pub fn is_non_counted(&self) -> bool
Returns true if this element is wrapped in Element::NonCounted.
The wrapper suppresses count propagation to the parent count tree but
leaves all other behavior (storage, hashing, sum propagation, internal
aggregation) unchanged.
pub fn is_not_summed(&self) -> bool
pub fn is_not_summed(&self) -> bool
Returns true if this element is wrapped in Element::NotSummed.
The wrapper suppresses sum propagation to the parent sum tree but
leaves all other behavior (storage, hashing, count propagation,
internal aggregation) unchanged.
pub fn is_not_counted_or_summed(&self) -> bool
pub fn is_not_counted_or_summed(&self) -> bool
Returns true if this element is wrapped in
Element::NotCountedOrSummed. The wrapper suppresses BOTH count
and sum propagation to the parent tree but leaves all other
behavior (storage, hashing, internal aggregation) unchanged.
pub fn is_wrapped(&self) -> bool
pub fn is_wrapped(&self) -> bool
Returns true if this element is wrapped in any of the wrapper
variants (NonCounted, NotSummed, NotCountedOrSummed). Useful
for paths that need to add the +1 wrapper-byte cost overhead
regardless of which wrapper is in use.
pub fn underlying(&self) -> &Element
pub fn underlying(&self) -> &Element
Returns the wrapped element if self is any wrapper (NonCounted,
NotSummed, or NotCountedOrSummed), else self. Use this when
you need to inspect the actual element type and don’t care whether
it is wrapped.
Only unwraps one level — the constructors and (de)serializers reject any wrapper nesting, so a single unwrap is always sufficient.
pub fn underlying_mut(&mut self) -> &mut Element
pub fn underlying_mut(&mut self) -> &mut Element
Mutable variant of [underlying].
pub fn into_underlying(self) -> Element
pub fn into_underlying(self) -> Element
Owned variant of [underlying].
pub fn sum_value_or_default(&self) -> i64
pub fn sum_value_or_default(&self) -> i64
Decoded the integer value in the SumItem element type, returns 0 for everything else.
NonCounted delegates to its inner element — sums still propagate
when the wrapper is inserted into a sum-bearing parent.
NotSummed and NotCountedOrSummed return 0 — those wrappers’
purpose is to contribute nothing to the parent sum tree.
ReferenceWithSumItem returns the explicit sum value carried on the
variant — independent of the resolved target’s value.
pub fn count_value_or_default(&self) -> u64
pub fn count_value_or_default(&self) -> u64
Decoded the integer value in the CountTree element type, returns 1 for everything else.
NonCounted and NotCountedOrSummed return 0 — both wrappers
suppress the parent count contribution.
NotSummed delegates to its inner — counts still propagate.
pub fn count_sum_value_or_default(&self) -> (u64, i64)
pub fn count_sum_value_or_default(&self) -> (u64, i64)
Decoded the count and sum values from the element type, returns (1, 0) for elements without count/sum semantics.
NonCounted returns (0, inner_sum) — count is suppressed, sum still
propagates.
NotSummed returns (inner_count, 0) — sum is suppressed, count
still propagates.
NotCountedOrSummed returns (0, 0) — both are suppressed.
ReferenceWithSumItem returns (1, sum_value) — counts as one
element like a plain reference, contributes its explicit sum.
pub fn big_sum_value_or_default(&self) -> i128
pub fn big_sum_value_or_default(&self) -> i128
Decoded the integer value in the SumItem element type, returns 0 for
everything else. NonCounted delegates to its inner. NotSummed
and NotCountedOrSummed return 0. ReferenceWithSumItem returns
its explicit i64 sum cast to i128.
pub fn as_sum_item_value(&self) -> Result<i64, ElementError>
pub fn as_sum_item_value(&self) -> Result<i64, ElementError>
Decoded the integer value in the SumItem element type. Looks through
a NonCounted wrapper. Also returns the explicit sum from
ReferenceWithSumItem.
pub fn into_sum_item_value(self) -> Result<i64, ElementError>
pub fn into_sum_item_value(self) -> Result<i64, ElementError>
Decoded the integer value in the SumItem element type. Looks through
a NonCounted wrapper. Also returns the explicit sum from
ReferenceWithSumItem.
pub fn as_sum_tree_value(&self) -> Result<i64, ElementError>
pub fn as_sum_tree_value(&self) -> Result<i64, ElementError>
Decoded the integer value in the SumTree element type. Looks through
a NonCounted wrapper.
pub fn into_sum_tree_value(self) -> Result<i64, ElementError>
pub fn into_sum_tree_value(self) -> Result<i64, ElementError>
Decoded the integer value in the SumTree element type. Looks through
a NonCounted wrapper.
pub fn as_item_bytes(&self) -> Result<&[u8], ElementError>
pub fn as_item_bytes(&self) -> Result<&[u8], ElementError>
Gives the item value in the Item element type. Looks through a
NonCounted wrapper.
pub fn into_item_bytes(self) -> Result<Vec<u8>, ElementError>
pub fn into_item_bytes(self) -> Result<Vec<u8>, ElementError>
Gives the item value in the Item element type. Looks through a
NonCounted wrapper.
pub fn into_reference_path_type(self) -> Result<ReferencePathType, ElementError>
pub fn into_reference_path_type(self) -> Result<ReferencePathType, ElementError>
Gives the reference path type in the Reference element type. Looks
through a NonCounted wrapper. Accepts both Reference and
ReferenceWithSumItem.
pub fn is_sum_tree(&self) -> bool
pub fn is_sum_tree(&self) -> bool
Check if the element is a sum tree. Looks through NonCounted.
pub fn is_big_sum_tree(&self) -> bool
pub fn is_big_sum_tree(&self) -> bool
Check if the element is a big sum tree. Looks through NonCounted.
pub fn is_provable_sum_tree(&self) -> bool
pub fn is_provable_sum_tree(&self) -> bool
Check if the element is a provable sum tree. Looks through wrappers.
pub fn as_provable_sum_tree_value(&self) -> Result<i64, ElementError>
pub fn as_provable_sum_tree_value(&self) -> Result<i64, ElementError>
Decoded sum value from a ProvableSumTree. Looks through wrappers.
pub fn into_provable_sum_tree_value(self) -> Result<i64, ElementError>
pub fn into_provable_sum_tree_value(self) -> Result<i64, ElementError>
Owned variant of [as_provable_sum_tree_value].
pub fn is_provable_count_provable_sum_tree(&self) -> bool
pub fn is_provable_count_provable_sum_tree(&self) -> bool
Check if the element is a ProvableCountProvableSumTree. Looks through
wrappers.
pub fn as_provable_count_provable_sum_tree_value(
&self,
) -> Result<(u64, i64), ElementError>
pub fn as_provable_count_provable_sum_tree_value( &self, ) -> Result<(u64, i64), ElementError>
Decoded (count, sum) from a ProvableCountProvableSumTree. Looks
through wrappers.
pub fn into_provable_count_provable_sum_tree_value(
self,
) -> Result<(u64, i64), ElementError>
pub fn into_provable_count_provable_sum_tree_value( self, ) -> Result<(u64, i64), ElementError>
Owned variant of [as_provable_count_provable_sum_tree_value].
pub fn is_basic_tree(&self) -> bool
pub fn is_basic_tree(&self) -> bool
Check if the element is a tree but not a sum tree. Looks through
NonCounted.
pub fn is_any_tree(&self) -> bool
pub fn is_any_tree(&self) -> bool
Check if the element is a tree. Looks through NonCounted.
pub fn is_commitment_tree(&self) -> bool
pub fn is_commitment_tree(&self) -> bool
Check if the element is a commitment tree. Looks through NonCounted.
pub fn is_mmr_tree(&self) -> bool
pub fn is_mmr_tree(&self) -> bool
Check if the element is an MMR tree. Looks through NonCounted.
pub fn is_bulk_append_tree(&self) -> bool
pub fn is_bulk_append_tree(&self) -> bool
Check if the element is a bulk append tree. Looks through NonCounted.
pub fn is_dense_tree(&self) -> bool
pub fn is_dense_tree(&self) -> bool
Check if the element is a dense append-only fixed-size tree. Looks
through NonCounted.
pub fn uses_non_merk_data_storage(&self) -> bool
pub fn uses_non_merk_data_storage(&self) -> bool
Check if the element is a tree type that stores data in the data namespace as non-Merk entries. These tree types have an always-empty Merk (root_key = None) and never contain child subtrees. The data namespace must be cleared directly rather than iterated as Merk elements.
Note: This must be kept in sync with
TreeType::uses_non_merk_data_storage() in the merk crate.
Looks through NonCounted.
pub fn non_merk_entry_count(&self) -> Option<u64>
pub fn non_merk_entry_count(&self) -> Option<u64>
Returns the entry count for non-Merk data tree types, or None for
regular Merk trees and non-tree elements. This is used by delete
and is_empty_tree operations to determine emptiness without
iterating the data namespace. Looks through NonCounted.
pub fn is_non_empty_tree(&self) -> bool
pub fn is_non_empty_tree(&self) -> bool
Check if the element is a non-empty tree that should have child data.
For merk-backed trees this means the root key is Some(_) (at least one
node). Non-merk tree types (MmrTree, BulkAppendTree, CommitmentTree,
DenseAppendOnlyFixedSizeTree) always carry their own data and are
considered non-empty regardless of their count field.
Looks through NonCounted.
pub fn is_non_empty_merk_tree(&self) -> bool
pub fn is_non_empty_merk_tree(&self) -> bool
Check if the element is a non-empty Merk-backed tree.
Returns true only for standard Merk trees (Tree, SumTree, BigSumTree,
CountTree, CountSumTree, ProvableCountTree, ProvableCountSumTree)
with a Some(_) root key. Excludes non-Merk tree types (MmrTree,
BulkAppendTree, CommitmentTree, DenseAppendOnlyFixedSizeTree).
Looks through NonCounted.
pub fn is_reference(&self) -> bool
pub fn is_reference(&self) -> bool
Check if the element is a reference. Looks through NonCounted. Both
Reference and ReferenceWithSumItem are references — they share
the resolution path and combined-value-hash proof shape; the only
difference is that ReferenceWithSumItem carries an additional
SumValue that propagates into sum-bearing parents.
pub fn is_reference_with_sum_item(&self) -> bool
pub fn is_reference_with_sum_item(&self) -> bool
Check if the element is specifically a ReferenceWithSumItem. Looks
through NonCounted. Use is_reference when you only care that the
element is some kind of reference; use this when you need to
distinguish the sum-bearing variant.
pub fn is_any_item(&self) -> bool
pub fn is_any_item(&self) -> bool
Check if the element is an item. Looks through NonCounted.
pub fn is_basic_item(&self) -> bool
pub fn is_basic_item(&self) -> bool
Check if the element is a basic item. Looks through NonCounted.
pub fn has_basic_item(&self) -> bool
pub fn has_basic_item(&self) -> bool
Check if the element has a basic item value (Item or ItemWithSumItem).
Looks through NonCounted.
pub fn is_sum_item(&self) -> bool
pub fn is_sum_item(&self) -> bool
Check if the element is a sum item. Looks through NonCounted.
pub fn is_item_with_sum_item(&self) -> bool
pub fn is_item_with_sum_item(&self) -> bool
Check if the element is an item-with-sum-item. Looks through
NonCounted.
pub fn get_flags(&self) -> &Option<Vec<u8>>
pub fn get_flags(&self) -> &Option<Vec<u8>>
Grab the optional flag stored in an element. For NonCounted, returns
the inner element’s flags.
pub fn get_flags_owned(self) -> Option<Vec<u8>>
pub fn get_flags_owned(self) -> Option<Vec<u8>>
Grab the optional flag stored in an element. For NonCounted, returns
the inner element’s flags.
pub fn get_flags_mut(&mut self) -> &mut Option<Vec<u8>>
pub fn get_flags_mut(&mut self) -> &mut Option<Vec<u8>>
Grab the optional flag stored in an element as mutable. For
NonCounted, returns a mutable reference to the inner element’s flags.
pub fn set_flags(&mut self, new_flags: Option<Vec<u8>>)
pub fn set_flags(&mut self, new_flags: Option<Vec<u8>>)
Sets the optional flag stored in an element. For NonCounted, sets
the inner element’s flags.
pub fn required_item_space(
len: u32,
flag_len: u32,
grove_version: &GroveVersion,
) -> Result<u32, ElementError>
pub fn required_item_space( len: u32, flag_len: u32, grove_version: &GroveVersion, ) -> Result<u32, ElementError>
Get the required item space
pub fn required_item_with_sum_item_space(
len: u32,
flag_len: u32,
grove_version: &GroveVersion,
) -> Result<u32, ElementError>
pub fn required_item_with_sum_item_space( len: u32, flag_len: u32, grove_version: &GroveVersion, ) -> Result<u32, ElementError>
Worst-case serialized-storage cost of an
Element::ItemWithSumItem. Same shape as
Self::required_item_space with an extra worst-case allowance
for the i64 sum_value field.
The sum_value is bincode varint-encoded (with zigzag for negative
values) inside Element::serialize. The bincode 2.x varint encoding
for a u64 is at most 9 bytes (1 marker + 8 bytes). We use 10 here
as a deliberate upper-bound margin so callers using this for
stateless-cost / dry-run fee estimation never undercharge.
pub fn required_reference_with_sum_item_space(
path_len: u32,
flag_len: u32,
grove_version: &GroveVersion,
) -> Result<u32, ElementError>
pub fn required_reference_with_sum_item_space( path_len: u32, flag_len: u32, grove_version: &GroveVersion, ) -> Result<u32, ElementError>
Worst-case serialized-storage cost of an
Element::ReferenceWithSumItem. Parallels
Self::required_item_with_sum_item_space with the reference path
as the variable-length payload.
path_len is the worst-case serialized size of the
ReferencePathType payload (mirroring how callers compute the
reference_path upper bound for plain references). The +10
covers the worst-case i64 sum_value bincode varint; the +1
covers the element variant discriminant byte. The max_hop
(Option<u8>, ≤ 2 bytes) is small and should be folded into
path_len by the caller if exact upper-bound accounting matters
for their dry-run.
§impl Element
impl Element
pub fn serialize(
&self,
grove_version: &GroveVersion,
) -> Result<Vec<u8>, ElementError>
pub fn serialize( &self, grove_version: &GroveVersion, ) -> Result<Vec<u8>, ElementError>
Serializes self. Returns vector of u8s.
Rejects:
- Any wrapper nesting in any combination —
NonCounted,NotSummed, andNotCountedOrSummedare mutually exclusive. NotSummed(x)/NotCountedOrSummed(x)wherexis not one of the six sum-bearing tree variants (SumTree,BigSumTree,CountSumTree,ProvableCountSumTree,ProvableSumTree,ProvableCountProvableSumTree).
Constructed via the new_non_counted / new_not_summed /
new_not_counted_or_summed constructors these are impossible, but a
caller could build them directly.
pub fn serialized_size(
&self,
grove_version: &GroveVersion,
) -> Result<usize, ElementError>
pub fn serialized_size( &self, grove_version: &GroveVersion, ) -> Result<usize, ElementError>
Serializes self. Returns usize.
pub fn deserialize(
bytes: &[u8],
grove_version: &GroveVersion,
) -> Result<Element, ElementError>
pub fn deserialize( bytes: &[u8], grove_version: &GroveVersion, ) -> Result<Element, ElementError>
Deserializes given bytes and sets as self.
Pre-checks the leading bytes for any wrapper-byte combination and
rejects before invoking bincode. This closes a stack-exhaustion
vector: a hostile payload of repeated wrapper bytes would otherwise
cause bincode to recursively decode the Box<Element> chain (and
overflow the stack) before any post-decode check could fire. The
pre-check is O(1) — only the first two bytes matter.
The rejected leading byte pairs are every ordered combination of the three wrapper discriminants (15 NonCounted, 16 NotSummed, 17 NotCountedOrSummed) — nine in total.
§impl Element
impl Element
pub fn element_type(&self) -> ElementType
pub fn element_type(&self) -> ElementType
Returns the ElementType for this element.
For Element::NonCounted(inner), returns the matching NonCountedXxx
twin of the inner element’s type (high bit set). Nested wrappers are
disallowed at construction and serialization, so the inner is always
a base element.
pub fn type_str(&self) -> &str
pub fn validate_wrapper_invariants(&self) -> Result<(), ElementError>
pub fn validate_wrapper_invariants(&self) -> Result<(), ElementError>
Verify the wrapper invariants for self:
NonCounted,NotSummed, andNotCountedOrSummedmay not nest in any combination.NotSummedandNotCountedOrSummedmay only wrap one of the four sum-tree variants (SumTree,BigSumTree,CountSumTree,ProvableCountSumTree).
Constructors and the serialize/deserialize paths already enforce
these rules; this helper exists so external callers (most importantly
the manual serde::Deserialize impl) can apply the same checks.
Only the immediate wrapper layer is checked — wrapper nesting is forbidden by these very rules, so deeper recursion is not needed.
Trait Implementations§
§impl<'__de, __Context> BorrowDecode<'__de, __Context> for Element
impl<'__de, __Context> BorrowDecode<'__de, __Context> for Element
§fn borrow_decode<__D>(decoder: &mut __D) -> Result<Element, DecodeError>where
__D: BorrowDecoder<'__de, Context = __Context>,
fn borrow_decode<__D>(decoder: &mut __D) -> Result<Element, DecodeError>where
__D: BorrowDecoder<'__de, Context = __Context>,
§impl ElementAggregateSumQueryExtensions for Element
Available on crate feature minimal only.
impl ElementAggregateSumQueryExtensions for Element
minimal only.§fn get_aggregate_sum_query(
storage: &RocksDbStorage,
aggregate_sum_path_query: &AggregateSumPathQuery,
query_options: AggregateSumQueryOptions,
transaction: Option<&<RocksDbStorage as Storage<'_>>::Transaction>,
grove_version: &GroveVersion,
) -> CostContext<Result<AggregateSumQueryResult, Error>>
fn get_aggregate_sum_query( storage: &RocksDbStorage, aggregate_sum_path_query: &AggregateSumPathQuery, query_options: AggregateSumQueryOptions, transaction: Option<&<RocksDbStorage as Storage<'_>>::Transaction>, grove_version: &GroveVersion, ) -> CostContext<Result<AggregateSumQueryResult, Error>>
Returns a vector of result elements based on given query
§fn get_aggregate_sum_query_apply_function(
storage: &RocksDbStorage,
path: &[&[u8]],
aggregate_sum_query: &AggregateSumQuery,
query_options: AggregateSumQueryOptions,
transaction: Option<&<RocksDbStorage as Storage<'_>>::Transaction>,
add_element_function: fn(AggregateSumPathQueryPushArgs<'_, '_, '_>, &GroveVersion) -> CostContext<Result<(), Error>>,
grove_version: &GroveVersion,
) -> CostContext<Result<AggregateSumQueryResult, Error>>
fn get_aggregate_sum_query_apply_function( storage: &RocksDbStorage, path: &[&[u8]], aggregate_sum_query: &AggregateSumQuery, query_options: AggregateSumQueryOptions, transaction: Option<&<RocksDbStorage as Storage<'_>>::Transaction>, add_element_function: fn(AggregateSumPathQueryPushArgs<'_, '_, '_>, &GroveVersion) -> CostContext<Result<(), Error>>, grove_version: &GroveVersion, ) -> CostContext<Result<AggregateSumQueryResult, Error>>
Returns a vector of result sum items with keys based on given aggregate sum query
§fn aggregate_sum_path_query_push(
args: AggregateSumPathQueryPushArgs<'_, '_, '_>,
grove_version: &GroveVersion,
) -> CostContext<Result<(), Error>>
fn aggregate_sum_path_query_push( args: AggregateSumPathQueryPushArgs<'_, '_, '_>, grove_version: &GroveVersion, ) -> CostContext<Result<(), Error>>
Push arguments to path query
§fn aggregate_sum_query_item(
storage: &RocksDbStorage,
item: &QueryItem,
results: &mut Vec<(Vec<u8>, i64)>,
path: &[&[u8]],
left_to_right: bool,
transaction: Option<&<RocksDbStorage as Storage<'_>>::Transaction>,
limit: &mut Option<u16>,
sum_limit_left: &mut i64,
query_options: AggregateSumQueryOptions,
add_element_function: fn(AggregateSumPathQueryPushArgs<'_, '_, '_>, &GroveVersion) -> CostContext<Result<(), Error>>,
elements_scanned: &mut u16,
max_elements_scanned: u16,
grove_version: &GroveVersion,
) -> CostContext<Result<(), Error>>
fn aggregate_sum_query_item( storage: &RocksDbStorage, item: &QueryItem, results: &mut Vec<(Vec<u8>, i64)>, path: &[&[u8]], left_to_right: bool, transaction: Option<&<RocksDbStorage as Storage<'_>>::Transaction>, limit: &mut Option<u16>, sum_limit_left: &mut i64, query_options: AggregateSumQueryOptions, add_element_function: fn(AggregateSumPathQueryPushArgs<'_, '_, '_>, &GroveVersion) -> CostContext<Result<(), Error>>, elements_scanned: &mut u16, max_elements_scanned: u16, grove_version: &GroveVersion, ) -> CostContext<Result<(), Error>>
decrease_limit_on_range_with_no_sub_elements should generally be set
to true, as having it false could mean very expensive queries.
The queries would be expensive because we could go through many many
trees where the sub elements have no matches, hence the limit would
not decrease and hence we would continue on the increasingly
expensive query.
§fn basic_aggregate_sum_push(
args: AggregateSumPathQueryPushArgs<'_, '_, '_>,
grove_version: &GroveVersion,
) -> Result<(), Error>
fn basic_aggregate_sum_push( args: AggregateSumPathQueryPushArgs<'_, '_, '_>, grove_version: &GroveVersion, ) -> Result<(), Error>
§impl ElementCostExtensions for Element
impl ElementCostExtensions for Element
§fn specialized_costs_for_key_value(
key: &[u8],
value: &[u8],
node_type: NodeType,
grove_version: &GroveVersion,
) -> Result<u32, Error>
fn specialized_costs_for_key_value( key: &[u8], value: &[u8], node_type: NodeType, grove_version: &GroveVersion, ) -> Result<u32, Error>
Get tree costs for a key value
§fn specialized_value_defined_cost(
&self,
grove_version: &GroveVersion,
) -> Option<u32>
fn specialized_value_defined_cost( &self, grove_version: &GroveVersion, ) -> Option<u32>
Get the value defined cost for a serialized value item with sum item or
sum item. Looks through NonCounted (the +1 wrapper-byte cost is
already folded in by get_specialized_cost).
§fn layered_value_defined_cost(
&self,
grove_version: &GroveVersion,
) -> Option<u32>
fn layered_value_defined_cost( &self, grove_version: &GroveVersion, ) -> Option<u32>
Get the value defined cost for a serialized value item with a tree.
Looks through NonCounted.
§fn value_defined_cost(
&self,
grove_version: &GroveVersion,
) -> Option<ValueDefinedCostType>
fn value_defined_cost( &self, grove_version: &GroveVersion, ) -> Option<ValueDefinedCostType>
Get the value defined cost for a serialized value. Looks through
NonCounted.
§fn value_defined_cost_for_serialized_value(
value: &[u8],
grove_version: &GroveVersion,
) -> Option<ValueDefinedCostType>
fn value_defined_cost_for_serialized_value( value: &[u8], grove_version: &GroveVersion, ) -> Option<ValueDefinedCostType>
Get the value defined cost for a serialized value
§impl ElementCostPrivateExtensions for Element
impl ElementCostPrivateExtensions for Element
§fn get_specialized_cost(
&self,
grove_version: &GroveVersion,
) -> Result<u32, Error>
fn get_specialized_cost( &self, grove_version: &GroveVersion, ) -> Result<u32, Error>
Get tree cost for the element. For NonCounted, NotSummed, and
NotCountedOrSummed, delegates to the inner element and adds 1
byte for the wrapper discriminant.
§impl ElementDecodeExtensions for Element
impl ElementDecodeExtensions for Element
§fn raw_decode(
bytes: &[u8],
grove_version: &GroveVersion,
) -> Result<Element, Error>
fn raw_decode( bytes: &[u8], grove_version: &GroveVersion, ) -> Result<Element, Error>
Decode from bytes
§impl ElementDeleteFromStorageExtensions for Element
impl ElementDeleteFromStorageExtensions for Element
§fn delete<'db, K, S>(
merk: &mut Merk<S>,
key: K,
merk_options: Option<MerkOptions>,
is_layered: bool,
in_tree_type: TreeType,
grove_version: &GroveVersion,
) -> CostContext<Result<(), Error>>
fn delete<'db, K, S>( merk: &mut Merk<S>, key: K, merk_options: Option<MerkOptions>, is_layered: bool, in_tree_type: TreeType, grove_version: &GroveVersion, ) -> CostContext<Result<(), Error>>
Delete an element from Merk under a key
§fn delete_with_sectioned_removal_bytes<'db, K, S>(
merk: &mut Merk<S>,
key: K,
merk_options: Option<MerkOptions>,
is_layered: bool,
in_tree_type: TreeType,
sectioned_removal: &mut impl FnMut(&Vec<u8>, u32, u32) -> Result<(StorageRemovedBytes, StorageRemovedBytes), Error>,
grove_version: &GroveVersion,
) -> CostContext<Result<(), Error>>
fn delete_with_sectioned_removal_bytes<'db, K, S>( merk: &mut Merk<S>, key: K, merk_options: Option<MerkOptions>, is_layered: bool, in_tree_type: TreeType, sectioned_removal: &mut impl FnMut(&Vec<u8>, u32, u32) -> Result<(StorageRemovedBytes, StorageRemovedBytes), Error>, grove_version: &GroveVersion, ) -> CostContext<Result<(), Error>>
Delete an element from Merk under a key
§impl ElementExt for Element
impl ElementExt for Element
§fn value_hash(
&self,
grove_version: &GroveVersion,
) -> CostContext<Result<[u8; 32], ElementError>>
fn value_hash( &self, grove_version: &GroveVersion, ) -> CostContext<Result<[u8; 32], ElementError>>
§impl ElementFetchFromStorageExtensions for Element
impl ElementFetchFromStorageExtensions for Element
§fn get<'db, K, S>(
merk: &Merk<S>,
key: K,
allow_cache: bool,
grove_version: &GroveVersion,
) -> CostContext<Result<Element, Error>>
fn get<'db, K, S>( merk: &Merk<S>, key: K, allow_cache: bool, grove_version: &GroveVersion, ) -> CostContext<Result<Element, Error>>
Get an element from Merk under a key; path should be resolved and proper Merk should be loaded by this moment
§fn get_optional<'db, K, S>(
merk: &Merk<S>,
key: K,
allow_cache: bool,
grove_version: &GroveVersion,
) -> CostContext<Result<Option<Element>, Error>>
fn get_optional<'db, K, S>( merk: &Merk<S>, key: K, allow_cache: bool, grove_version: &GroveVersion, ) -> CostContext<Result<Option<Element>, Error>>
Get an element from Merk under a key; path should be resolved and proper Merk should be loaded by this moment
§fn get_from_storage<'db, K, S>(
storage: &S,
key: K,
grove_version: &GroveVersion,
) -> CostContext<Result<Element, Error>>
fn get_from_storage<'db, K, S>( storage: &S, key: K, grove_version: &GroveVersion, ) -> CostContext<Result<Element, Error>>
Get an element directly from storage under a key Merk does not need to be loaded Errors if element doesn’t exist
§fn get_optional_from_storage<'db, K, S>(
storage: &S,
key: K,
grove_version: &GroveVersion,
) -> CostContext<Result<Option<Element>, Error>>
fn get_optional_from_storage<'db, K, S>( storage: &S, key: K, grove_version: &GroveVersion, ) -> CostContext<Result<Option<Element>, Error>>
Get an element directly from storage under a key Merk does not need to be loaded
§fn get_with_absolute_refs<'db, K, S>(
merk: &Merk<S>,
path: &[&[u8]],
key: K,
allow_cache: bool,
grove_version: &GroveVersion,
) -> CostContext<Result<Element, Error>>
fn get_with_absolute_refs<'db, K, S>( merk: &Merk<S>, path: &[&[u8]], key: K, allow_cache: bool, grove_version: &GroveVersion, ) -> CostContext<Result<Element, Error>>
Get an element from Merk under a key; path should be resolved and proper Merk should be loaded by this moment
§fn get_optional_with_absolute_refs<'db, K, S>(
merk: &Merk<S>,
path: &[&[u8]],
key: K,
allow_cache: bool,
grove_version: &GroveVersion,
) -> CostContext<Result<Option<Element>, Error>>
fn get_optional_with_absolute_refs<'db, K, S>( merk: &Merk<S>, path: &[&[u8]], key: K, allow_cache: bool, grove_version: &GroveVersion, ) -> CostContext<Result<Option<Element>, Error>>
Get an element from Merk under a key; path should be resolved and proper Merk should be loaded by this moment
§impl ElementInsertToStorageExtensions for Element
impl ElementInsertToStorageExtensions for Element
§fn insert<'db, K, S>(
&self,
merk: &mut Merk<S>,
key: K,
options: Option<MerkOptions>,
grove_version: &GroveVersion,
) -> CostContext<Result<(), Error>>
fn insert<'db, K, S>( &self, merk: &mut Merk<S>, key: K, options: Option<MerkOptions>, grove_version: &GroveVersion, ) -> CostContext<Result<(), Error>>
Insert an element in Merk under a key; path should be resolved and proper Merk should be loaded by this moment If transaction is not passed, the batch will be written immediately. If transaction is passed, the operation will be committed on the transaction commit.
§fn insert_into_batch_operations<K>(
&self,
key: K,
batch_operations: &mut Vec<(K, Op)>,
feature_type: TreeFeatureType,
grove_version: &GroveVersion,
) -> CostContext<Result<(), Error>>
fn insert_into_batch_operations<K>( &self, key: K, batch_operations: &mut Vec<(K, Op)>, feature_type: TreeFeatureType, grove_version: &GroveVersion, ) -> CostContext<Result<(), Error>>
Add to batch operations a “Put” op with key and serialized element. Return CostResult.
§fn insert_if_not_exists<'db, S>(
&self,
merk: &mut Merk<S>,
key: &[u8],
options: Option<MerkOptions>,
grove_version: &GroveVersion,
) -> CostContext<Result<bool, Error>>where
S: StorageContext<'db>,
fn insert_if_not_exists<'db, S>(
&self,
merk: &mut Merk<S>,
key: &[u8],
options: Option<MerkOptions>,
grove_version: &GroveVersion,
) -> CostContext<Result<bool, Error>>where
S: StorageContext<'db>,
Insert an element in Merk under a key if it doesn’t yet exist; path should be resolved and proper Merk should be loaded by this moment If transaction is not passed, the batch will be written immediately. If transaction is passed, the operation will be committed on the transaction commit.
§fn insert_if_not_exists_into_batch_operations<'db, S, K>(
&self,
merk: &mut Merk<S>,
key: K,
batch_operations: &mut Vec<(K, Op)>,
feature_type: TreeFeatureType,
grove_version: &GroveVersion,
) -> CostContext<Result<bool, Error>>
fn insert_if_not_exists_into_batch_operations<'db, S, K>( &self, merk: &mut Merk<S>, key: K, batch_operations: &mut Vec<(K, Op)>, feature_type: TreeFeatureType, grove_version: &GroveVersion, ) -> CostContext<Result<bool, Error>>
Adds a “Put” op to batch operations with the element and key if it doesn’t exist yet. Returns CostResult.
§fn insert_if_changed_value<'db, S>(
&self,
merk: &mut Merk<S>,
key: &[u8],
options: Option<MerkOptions>,
grove_version: &GroveVersion,
) -> CostContext<Result<(bool, Option<Element>), Error>>where
S: StorageContext<'db>,
fn insert_if_changed_value<'db, S>(
&self,
merk: &mut Merk<S>,
key: &[u8],
options: Option<MerkOptions>,
grove_version: &GroveVersion,
) -> CostContext<Result<(bool, Option<Element>), Error>>where
S: StorageContext<'db>,
Insert an element in Merk under a key if the value is different from what already exists; path should be resolved and proper Merk should be loaded by this moment If transaction is not passed, the batch will be written immediately. If transaction is passed, the operation will be committed on the transaction commit. The bool represents if we indeed inserted. If the value changed we return the old element.
§fn insert_if_changed_value_into_batch_operations<'db, S, K>(
&self,
merk: &mut Merk<S>,
key: K,
batch_operations: &mut Vec<(K, Op)>,
feature_type: TreeFeatureType,
grove_version: &GroveVersion,
) -> CostContext<Result<(bool, Option<Element>), Error>>
fn insert_if_changed_value_into_batch_operations<'db, S, K>( &self, merk: &mut Merk<S>, key: K, batch_operations: &mut Vec<(K, Op)>, feature_type: TreeFeatureType, grove_version: &GroveVersion, ) -> CostContext<Result<(bool, Option<Element>), Error>>
Adds a “Put” op to batch operations with the element and key if the value is different from what already exists; Returns CostResult. The bool represents if we indeed inserted. If the value changed we return the old element.
§fn insert_reference<'db, K, S>(
&self,
merk: &mut Merk<S>,
key: K,
referenced_value: [u8; 32],
options: Option<MerkOptions>,
grove_version: &GroveVersion,
) -> CostContext<Result<(), Error>>
fn insert_reference<'db, K, S>( &self, merk: &mut Merk<S>, key: K, referenced_value: [u8; 32], options: Option<MerkOptions>, grove_version: &GroveVersion, ) -> CostContext<Result<(), Error>>
Insert a reference element in Merk under a key; path should be resolved and proper Merk should be loaded by this moment If transaction is not passed, the batch will be written immediately. If transaction is passed, the operation will be committed on the transaction commit.
§fn insert_reference_into_batch_operations<K>(
&self,
key: K,
referenced_value: [u8; 32],
batch_operations: &mut Vec<(K, Op)>,
feature_type: TreeFeatureType,
grove_version: &GroveVersion,
) -> CostContext<Result<(), Error>>
fn insert_reference_into_batch_operations<K>( &self, key: K, referenced_value: [u8; 32], batch_operations: &mut Vec<(K, Op)>, feature_type: TreeFeatureType, grove_version: &GroveVersion, ) -> CostContext<Result<(), Error>>
Adds a “Put” op to batch operations with reference and key. Returns CostResult.
§fn insert_subtree<'db, K, S>(
&self,
merk: &mut Merk<S>,
key: K,
subtree_root_hash: [u8; 32],
options: Option<MerkOptions>,
grove_version: &GroveVersion,
) -> CostContext<Result<(), Error>>
fn insert_subtree<'db, K, S>( &self, merk: &mut Merk<S>, key: K, subtree_root_hash: [u8; 32], options: Option<MerkOptions>, grove_version: &GroveVersion, ) -> CostContext<Result<(), Error>>
Insert a tree element in Merk under a key; path should be resolved and proper Merk should be loaded by this moment If transaction is not passed, the batch will be written immediately. If transaction is passed, the operation will be committed on the transaction commit.
§impl ElementQueryExtensions for Element
impl ElementQueryExtensions for Element
§fn get_query(
storage: &RocksDbStorage,
merk_path: &[&[u8]],
query: &Query,
query_options: QueryOptions,
result_type: QueryResultType,
transaction: Option<&<RocksDbStorage as Storage<'_>>::Transaction>,
grove_version: &GroveVersion,
) -> CostContext<Result<QueryResultElements, Error>>
fn get_query( storage: &RocksDbStorage, merk_path: &[&[u8]], query: &Query, query_options: QueryOptions, result_type: QueryResultType, transaction: Option<&<RocksDbStorage as Storage<'_>>::Transaction>, grove_version: &GroveVersion, ) -> CostContext<Result<QueryResultElements, Error>>
Returns a vector of result elements based on given query
§fn get_query_values(
storage: &RocksDbStorage,
merk_path: &[&[u8]],
query: &Query,
query_options: QueryOptions,
transaction: Option<&<RocksDbStorage as Storage<'_>>::Transaction>,
grove_version: &GroveVersion,
) -> CostContext<Result<Vec<Element>, Error>>
fn get_query_values( storage: &RocksDbStorage, merk_path: &[&[u8]], query: &Query, query_options: QueryOptions, transaction: Option<&<RocksDbStorage as Storage<'_>>::Transaction>, grove_version: &GroveVersion, ) -> CostContext<Result<Vec<Element>, Error>>
Get values of result elements coming from given query
§fn get_query_apply_function(
storage: &RocksDbStorage,
path: &[&[u8]],
sized_query: &SizedQuery,
query_options: QueryOptions,
result_type: QueryResultType,
transaction: Option<&<RocksDbStorage as Storage<'_>>::Transaction>,
add_element_function: fn(PathQueryPushArgs<'_, '_, '_>, &GroveVersion) -> CostContext<Result<(), Error>>,
grove_version: &GroveVersion,
) -> CostContext<Result<(QueryResultElements, u16), Error>>
fn get_query_apply_function( storage: &RocksDbStorage, path: &[&[u8]], sized_query: &SizedQuery, query_options: QueryOptions, result_type: QueryResultType, transaction: Option<&<RocksDbStorage as Storage<'_>>::Transaction>, add_element_function: fn(PathQueryPushArgs<'_, '_, '_>, &GroveVersion) -> CostContext<Result<(), Error>>, grove_version: &GroveVersion, ) -> CostContext<Result<(QueryResultElements, u16), Error>>
Returns a vector of result elements and the number of skipped items based on given query
§fn get_path_query(
storage: &RocksDbStorage,
path_query: &PathQuery,
query_options: QueryOptions,
result_type: QueryResultType,
transaction: Option<&<RocksDbStorage as Storage<'_>>::Transaction>,
grove_version: &GroveVersion,
) -> CostContext<Result<(QueryResultElements, u16), Error>>
fn get_path_query( storage: &RocksDbStorage, path_query: &PathQuery, query_options: QueryOptions, result_type: QueryResultType, transaction: Option<&<RocksDbStorage as Storage<'_>>::Transaction>, grove_version: &GroveVersion, ) -> CostContext<Result<(QueryResultElements, u16), Error>>
Returns a vector of elements excluding trees, and the number of skipped elements
§fn get_sized_query(
storage: &RocksDbStorage,
path: &[&[u8]],
sized_query: &SizedQuery,
query_options: QueryOptions,
result_type: QueryResultType,
transaction: Option<&<RocksDbStorage as Storage<'_>>::Transaction>,
grove_version: &GroveVersion,
) -> CostContext<Result<(QueryResultElements, u16), Error>>
fn get_sized_query( storage: &RocksDbStorage, path: &[&[u8]], sized_query: &SizedQuery, query_options: QueryOptions, result_type: QueryResultType, transaction: Option<&<RocksDbStorage as Storage<'_>>::Transaction>, grove_version: &GroveVersion, ) -> CostContext<Result<(QueryResultElements, u16), Error>>
Returns a vector of elements, and the number of skipped elements
§fn path_query_push(
args: PathQueryPushArgs<'_, '_, '_>,
grove_version: &GroveVersion,
) -> CostContext<Result<(), Error>>
fn path_query_push( args: PathQueryPushArgs<'_, '_, '_>, grove_version: &GroveVersion, ) -> CostContext<Result<(), Error>>
Push arguments to path query
§fn subquery_paths_and_value_for_sized_query(
sized_query: &SizedQuery,
key: &[u8],
) -> (Option<Vec<Vec<u8>>>, Option<Query>)
fn subquery_paths_and_value_for_sized_query( sized_query: &SizedQuery, key: &[u8], ) -> (Option<Vec<Vec<u8>>>, Option<Query>)
Takes a sized query and a key and returns subquery key and subquery as tuple
§fn query_item(
storage: &RocksDbStorage,
item: &QueryItem,
results: &mut Vec<QueryResultElement>,
path: &[&[u8]],
sized_query: &SizedQuery,
transaction: Option<&<RocksDbStorage as Storage<'_>>::Transaction>,
limit: &mut Option<u16>,
offset: &mut Option<u16>,
query_options: QueryOptions,
result_type: QueryResultType,
add_element_function: fn(PathQueryPushArgs<'_, '_, '_>, &GroveVersion) -> CostContext<Result<(), Error>>,
grove_version: &GroveVersion,
) -> CostContext<Result<(), Error>>
fn query_item( storage: &RocksDbStorage, item: &QueryItem, results: &mut Vec<QueryResultElement>, path: &[&[u8]], sized_query: &SizedQuery, transaction: Option<&<RocksDbStorage as Storage<'_>>::Transaction>, limit: &mut Option<u16>, offset: &mut Option<u16>, query_options: QueryOptions, result_type: QueryResultType, add_element_function: fn(PathQueryPushArgs<'_, '_, '_>, &GroveVersion) -> CostContext<Result<(), Error>>, grove_version: &GroveVersion, ) -> CostContext<Result<(), Error>>
decrease_limit_on_range_with_no_sub_elements should generally be set
to true, as having it false could mean very expensive queries.
The queries would be expensive because we could go through many
trees where the sub elements have no matches, hence the limit would
not decrease and hence we would continue on the increasingly
expensive query.
§fn basic_push(
args: PathQueryPushArgs<'_, '_, '_>,
grove_version: &GroveVersion,
) -> Result<(), Error>
fn basic_push( args: PathQueryPushArgs<'_, '_, '_>, grove_version: &GroveVersion, ) -> Result<(), Error>
§impl ElementTreeTypeExtensions for Element
impl ElementTreeTypeExtensions for Element
§fn root_key_and_tree_type_owned(self) -> Option<(Option<Vec<u8>>, TreeType)>
fn root_key_and_tree_type_owned(self) -> Option<(Option<Vec<u8>>, TreeType)>
Check if the element is a tree and return the root_tree info and tree
type. Looks through NonCounted.
§fn root_key_and_tree_type(&self) -> Option<(&Option<Vec<u8>>, TreeType)>
fn root_key_and_tree_type(&self) -> Option<(&Option<Vec<u8>>, TreeType)>
Check if the element is a tree and return the root_tree info and the
tree type. Looks through NonCounted.
§fn tree_flags_and_type(&self) -> Option<(&Option<Vec<u8>>, TreeType)>
fn tree_flags_and_type(&self) -> Option<(&Option<Vec<u8>>, TreeType)>
Check if the element is a tree and return the flags and the tree type.
Looks through NonCounted.
§fn tree_type(&self) -> Option<TreeType>
fn tree_type(&self) -> Option<TreeType>
Check if the element is a tree and return the tree type. Looks through
NonCounted.
§fn tree_feature_type(&self) -> Option<TreeFeatureType>
fn tree_feature_type(&self) -> Option<TreeFeatureType>
Check if the element is a tree and return the aggregate of elements in
the tree. Looks through NonCounted.
§fn maybe_tree_type(&self) -> MaybeTree
fn maybe_tree_type(&self) -> MaybeTree
Check if the element is a tree and return the tree type. Looks through
NonCounted.
§fn get_feature_type(
&self,
parent_tree_type: TreeType,
) -> Result<TreeFeatureType, Error>
fn get_feature_type( &self, parent_tree_type: TreeType, ) -> Result<TreeFeatureType, Error>
Get the tree feature type.
count_value_or_default and count_sum_value_or_default already
return 0 (resp. (0, inner_sum)) for Element::NonCounted,
sum_value_or_default / big_sum_value_or_default /
count_sum_value_or_default already return 0 (resp. (inner_count, 0))
for Element::NotSummed, and all four helpers return 0 (resp.
(0, 0)) for Element::NotCountedOrSummed. So the existing dispatch
produces the right feature type for every wrapper without an
explicit branch here.
impl Eq for Element
impl StructuralPartialEq for Element
Auto Trait Implementations§
impl Freeze for Element
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnsafeUnpin for Element
impl UnwindSafe for Element
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<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
§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.