pub struct LocalExitTree<const TREE_DEPTH: usize = 32> {
pub leaf_count: u32,
pub frontier: [Digest; TREE_DEPTH],
}
Expand description
Represents a local exit tree as defined by the LxLy bridge.
Fields§
§leaf_count: u32
The number of inserted (non-empty) leaves.
frontier: [Digest; TREE_DEPTH]
The frontier, with hashes from bottom to top, only of the rightmost non-empty node. This is not a path in the tree, and only contains full subtrees.
It contains meaningful values only up to the current root of the tree, computed by log2(leaf_count). After that, all values are zeroed out.
Implementations§
Source§impl<const TREE_DEPTH: usize> LocalExitTree<TREE_DEPTH>
impl<const TREE_DEPTH: usize> LocalExitTree<TREE_DEPTH>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new empty LocalExitTree
.
pub fn leaf_count(&self) -> u32
pub fn frontier(&self) -> [Digest; TREE_DEPTH]
Sourcepub fn from_leaves(
leaves: impl Iterator<Item = Digest>,
) -> Result<Self, LocalExitTreeError>
pub fn from_leaves( leaves: impl Iterator<Item = Digest>, ) -> Result<Self, LocalExitTreeError>
Creates a new LocalExitTree
and populates its leaves.
Sourcepub fn from_parts(leaf_count: u32, frontier: [Digest; TREE_DEPTH]) -> Self
pub fn from_parts(leaf_count: u32, frontier: [Digest; TREE_DEPTH]) -> Self
Creates a new LocalExitTree
from its parts: leaf count, and
frontier.
Trait Implementations§
Source§impl<const TREE_DEPTH: usize> Clone for LocalExitTree<TREE_DEPTH>
impl<const TREE_DEPTH: usize> Clone for LocalExitTree<TREE_DEPTH>
Source§fn clone(&self) -> LocalExitTree<TREE_DEPTH>
fn clone(&self) -> LocalExitTree<TREE_DEPTH>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<const TREE_DEPTH: usize> Debug for LocalExitTree<TREE_DEPTH>
impl<const TREE_DEPTH: usize> Debug for LocalExitTree<TREE_DEPTH>
Source§impl<const TREE_DEPTH: usize> Default for LocalExitTree<TREE_DEPTH>
impl<const TREE_DEPTH: usize> Default for LocalExitTree<TREE_DEPTH>
Source§impl<'de, const TREE_DEPTH: usize> Deserialize<'de> for LocalExitTree<TREE_DEPTH>
impl<'de, const TREE_DEPTH: usize> Deserialize<'de> for LocalExitTree<TREE_DEPTH>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<const TREE_DEPTH: usize> Freeze for LocalExitTree<TREE_DEPTH>
impl<const TREE_DEPTH: usize> RefUnwindSafe for LocalExitTree<TREE_DEPTH>
impl<const TREE_DEPTH: usize> Send for LocalExitTree<TREE_DEPTH>
impl<const TREE_DEPTH: usize> Sync for LocalExitTree<TREE_DEPTH>
impl<const TREE_DEPTH: usize> Unpin for LocalExitTree<TREE_DEPTH>
impl<const TREE_DEPTH: usize> UnwindSafe for LocalExitTree<TREE_DEPTH>
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