Struct bridgetree::Frontier
source · pub struct Frontier<H, const DEPTH: u8> { /* private fields */ }
Expand description
A possibly-empty Merkle frontier.
Implementations§
source§impl<H, const DEPTH: u8> Frontier<H, DEPTH>
impl<H, const DEPTH: u8> Frontier<H, DEPTH>
sourcepub fn from_parts(
position: Position,
leaf: H,
ommers: Vec<H>
) -> Result<Self, FrontierError>
pub fn from_parts(
position: Position,
leaf: H,
ommers: Vec<H>
) -> Result<Self, FrontierError>
Constructs a new frontier from its constituent parts.
Returns None
if the new frontier would exceed the maximum
allowed depth or if the list of ommers provided is not consistent
with the position of the leaf.
sourcepub fn value(&self) -> Option<&NonEmptyFrontier<H>>
pub fn value(&self) -> Option<&NonEmptyFrontier<H>>
Return the wrapped NonEmptyFrontier reference, or None if the frontier is empty.
sourcepub fn dynamic_memory_usage(&self) -> usize
pub fn dynamic_memory_usage(&self) -> usize
Returns the amount of memory dynamically allocated for ommer values within the frontier.
Trait Implementations§
source§impl<'de, H, const DEPTH: u8> Deserialize<'de> for Frontier<H, DEPTH>where
H: Deserialize<'de>,
impl<'de, H, const DEPTH: u8> Deserialize<'de> for Frontier<H, DEPTH>where
H: Deserialize<'de>,
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
source§impl<H: PartialEq, const DEPTH: u8> PartialEq<Frontier<H, DEPTH>> for Frontier<H, DEPTH>
impl<H: PartialEq, const DEPTH: u8> PartialEq<Frontier<H, DEPTH>> for Frontier<H, DEPTH>
source§impl<H, const DEPTH: u8> TryFrom<NonEmptyFrontier<H>> for Frontier<H, DEPTH>
impl<H, const DEPTH: u8> TryFrom<NonEmptyFrontier<H>> for Frontier<H, DEPTH>
§type Error = FrontierError
type Error = FrontierError
The type returned in the event of a conversion error.
source§fn try_from(f: NonEmptyFrontier<H>) -> Result<Self, FrontierError>
fn try_from(f: NonEmptyFrontier<H>) -> Result<Self, FrontierError>
Performs the conversion.