pub struct Tmr(/* private fields */);Expand description
Type Merkle root
A Merkle root that commits to a type’s primitive (unit, sum, product) and recursively its sub-types.
Uniquely identifies a type.
Implementations§
Source§impl Tmr
impl Tmr
Sourcepub const fn from_byte_array(data: [u8; 32]) -> Self
pub const fn from_byte_array(data: [u8; 32]) -> Self
Converts the given tagged hash into a byte array
Sourcepub const fn to_byte_array(self) -> [u8; 32]
pub const fn to_byte_array(self) -> [u8; 32]
Converts the given tagged hash into a byte array
Sourcepub const fn as_byte_array(&self) -> &[u8; 32]
pub const fn as_byte_array(&self) -> &[u8; 32]
Converts the given tagged hash into a byte array
Source§impl Tmr
impl Tmr
Sourcepub const BUFFER8_TWO_N_PLUS_ONE: [Tmr; 16]
pub const BUFFER8_TWO_N_PLUS_ONE: [Tmr; 16]
The TMRs of the types (TWO^8)^<(2^(N + 1)) for small values of n
Sourcepub fn successor(self) -> Tmr
pub fn successor(self) -> Tmr
The TMR for the successor of a type.
Given a type X, we define its successor S X as 1 + X.
In Rust notation this would be Option<X>.
Sourcepub const fn sum_unoptimized(tmr1: Tmr, tmr2: Tmr) -> Tmr
pub const fn sum_unoptimized(tmr1: Tmr, tmr2: Tmr) -> Tmr
The TMR for the sum of two types, whose TMRs are given
This function is slow but can be used in a const context. If you do not
need to run in a const context, use Self::sum instead.
Sourcepub fn product(tmr1: Tmr, tmr2: Tmr) -> Tmr
pub fn product(tmr1: Tmr, tmr2: Tmr) -> Tmr
The TMR for the product of two types, whose TMRs are given
Sourcepub const fn product_unoptimized(tmr1: Tmr, tmr2: Tmr) -> Tmr
pub const fn product_unoptimized(tmr1: Tmr, tmr2: Tmr) -> Tmr
The TMR for the product of two types, whose TMRs are given
This function is slow but can be used in a const context. If you do not
need to run in a const context, use Self::product instead.