pub struct IntentTree { /* private fields */ }Expand description
A Merkle tree over a set of authorized intent hashes.
The root commits to the full intent set without revealing its members. Leaves are sorted and deduplicated, so the root is deterministic regardless of insertion order.
Implementations§
Source§impl IntentTree
impl IntentTree
Sourcepub fn build(intents: Vec<IntentHash>) -> Result<Self, A1Error>
pub fn build(intents: Vec<IntentHash>) -> Result<Self, A1Error>
Build a tree from a set of intent hashes.
Returns A1Error::EmptyTree if intents is empty.
Sourcepub fn root(&self) -> IntentHash
pub fn root(&self) -> IntentHash
The Merkle root — the canonical commitment to this intent set.
Sourcepub fn prove(&self, intent: &IntentHash) -> Result<MerkleProof, A1Error>
pub fn prove(&self, intent: &IntentHash) -> Result<MerkleProof, A1Error>
Generate an inclusion proof for intent.
Returns A1Error::IntentNotFound if the intent is not in this tree.
pub fn contains(&self, intent: &IntentHash) -> bool
pub fn leaf_count(&self) -> usize
Auto Trait Implementations§
impl Freeze for IntentTree
impl RefUnwindSafe for IntentTree
impl Send for IntentTree
impl Sync for IntentTree
impl Unpin for IntentTree
impl UnsafeUnpin for IntentTree
impl UnwindSafe for IntentTree
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
Mutably borrows from an owned value. Read more