Enum miden_core::AdviceSet
source · pub enum AdviceSet {
MerkleTree(MerkleTree),
SparseMerkleTree(SparseMerkleTree),
MerklePathSet(MerklePathSet),
}
Expand description
TODO: add docs
Variants
Implementations
sourceimpl AdviceSet
impl AdviceSet
sourcepub fn new_merkle_tree(leaves: Vec<Word>) -> Result<Self, AdviceSetError>
pub fn new_merkle_tree(leaves: Vec<Word>) -> Result<Self, AdviceSetError>
sourcepub fn new_sparse_merkle_tree(
keys: Vec<u64>,
values: Vec<Word>,
depth: u32
) -> Result<Self, AdviceSetError>
pub fn new_sparse_merkle_tree(
keys: Vec<u64>,
values: Vec<Word>,
depth: u32
) -> Result<Self, AdviceSetError>
sourcepub fn get_node(&self, depth: u32, index: u64) -> Result<Word, AdviceSetError>
pub fn get_node(&self, depth: u32, index: u64) -> Result<Word, AdviceSetError>
Returns a node located at the specified depth and index.
Errors
Returns an error if:
- The specified depth is greater than the depth of this advice set.
- The specified index is invalid in the context of the specified depth.
- This advice set does not contain a node at the specified index and depth.
sourcepub fn get_path(
&self,
depth: u32,
index: u64
) -> Result<Vec<Word>, AdviceSetError>
pub fn get_path(
&self,
depth: u32,
index: u64
) -> Result<Vec<Word>, AdviceSetError>
Returns a Merkle path to a node located at the specified depth and index. The node itself is not included in the path.
Errors
Returns an error if:
- The specified depth is greater than the depth of this advice set.
- The specified index is invalid in the context of the specified depth.
- This advice set does not contain a node at the specified index and depth.
sourcepub fn update_leaf(
&mut self,
index: u64,
value: Word
) -> Result<(), AdviceSetError>
pub fn update_leaf(
&mut self,
index: u64,
value: Word
) -> Result<(), AdviceSetError>
Replaces the leaf at the specified index with the provided value.
Errors
Returns an error if:
- The specified index is not a valid leaf index for this advice set.
- This advice set does not contain a leaf at the specified index.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for AdviceSet
impl Send for AdviceSet
impl Sync for AdviceSet
impl Unpin for AdviceSet
impl UnwindSafe for AdviceSet
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more