pub struct MerkleNode {
pub branching: NodeBranching,
pub depth: u8,
pub width: u256,
pub node1: MerkleHash,
pub node2: MerkleHash,
}
Expand description
A node in the merkle tree used during the merklization process.
The data are hashed using CommitEncode
procedure, ensuring that each
node commits to its types, leaves, depth, and witdth of the tree at the node
depth.
Fields§
§branching: NodeBranching
A type of the node, based on its leaves.
depth: u8
A depth of the node, with the root being a zero depth.
width: u256
The width of the merkle tree at the depth of the node.
node1: MerkleHash
First leaf of the node.
node2: MerkleHash
Second leaf of the node.
Implementations§
Source§impl MerkleNode
impl MerkleNode
Sourcepub fn void(depth: impl Into<u8>, width: impl Into<u256>) -> Self
pub fn void(depth: impl Into<u8>, width: impl Into<u256>) -> Self
Construct a non-existing (virtual) merkle node.
Sourcepub fn single(
depth: impl Into<u8>,
width: impl Into<u256>,
node: MerkleHash,
) -> Self
pub fn single( depth: impl Into<u8>, width: impl Into<u256>, node: MerkleHash, ) -> Self
Construct a merkle node with just a single leaf.
Sourcepub fn branches(
depth: impl Into<u8>,
width: impl Into<u256>,
node1: MerkleHash,
node2: MerkleHash,
) -> Self
pub fn branches( depth: impl Into<u8>, width: impl Into<u256>, node1: MerkleHash, node2: MerkleHash, ) -> Self
Construct a merkle node with two leaves.
Trait Implementations§
Source§impl Clone for MerkleNode
impl Clone for MerkleNode
Source§fn clone(&self) -> MerkleNode
fn clone(&self) -> MerkleNode
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 CommitEncode for MerkleNode
impl CommitEncode for MerkleNode
Source§type CommitmentId = MerkleHash
type CommitmentId = MerkleHash
Type of the resulting commitment.
Source§fn commit_encode(&self, engine: &mut CommitEngine)
fn commit_encode(&self, engine: &mut CommitEngine)
Encodes the data for the commitment by writing them directly into a
std::io::Write
writer instanceSource§impl Debug for MerkleNode
impl Debug for MerkleNode
Source§impl Hash for MerkleNode
impl Hash for MerkleNode
Source§impl PartialEq for MerkleNode
impl PartialEq for MerkleNode
Source§impl StrictDecode for MerkleNode
impl StrictDecode for MerkleNode
fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError>
fn strict_read(reader: impl ReadRaw) -> Result<Self, DecodeError>
Source§impl StrictDumb for MerkleNode
impl StrictDumb for MerkleNode
fn strict_dumb() -> Self
Source§impl StrictEncode for MerkleNode
impl StrictEncode for MerkleNode
fn strict_encode<W: TypedWrite>(&self, writer: W) -> Result<W>
fn strict_write(&self, writer: impl WriteRaw) -> Result<(), Error>
Source§impl StrictStruct for MerkleNode
impl StrictStruct for MerkleNode
const ALL_FIELDS: &'static [&'static str]
fn strict_check_fields()
fn strict_type_info() -> TypeInfo<Self>
Source§impl StrictType for MerkleNode
impl StrictType for MerkleNode
const STRICT_LIB_NAME: &'static str = LIB_NAME_COMMIT_VERIFY
fn strict_name() -> Option<TypeName>
impl Copy for MerkleNode
impl Eq for MerkleNode
impl StrictProduct for MerkleNode
impl StructuralPartialEq for MerkleNode
Auto Trait Implementations§
impl Freeze for MerkleNode
impl RefUnwindSafe for MerkleNode
impl Send for MerkleNode
impl Sync for MerkleNode
impl Unpin for MerkleNode
impl UnwindSafe for MerkleNode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CommitId for Twhere
T: CommitEncode,
impl<T> CommitId for Twhere
T: CommitEncode,
fn commit(&self) -> CommitEngine
Source§fn commit_id(&self) -> <T as CommitEncode>::CommitmentId
fn commit_id(&self) -> <T as CommitEncode>::CommitmentId
Performs commitment to client-side-validated data
Source§impl<T> CommitmentLayout for T
impl<T> CommitmentLayout for T
Source§fn commitment_layout() -> CommitLayout
fn commitment_layout() -> CommitLayout
Generate a descriptive commitment layout, which includes a description
of each encoded field and the used hashing strategies.
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
Compare self to
key
and return true
if they are equal.