pub trait MastForestView {
// Required methods
fn node_count(&self) -> usize;
fn node_entry_at(
&self,
index: usize,
) -> Result<MastNodeEntry, DeserializationError>;
fn node_digest_at(&self, index: usize) -> Result<Word, DeserializationError>;
fn procedure_root_count(&self) -> usize;
fn procedure_root_at(
&self,
index: usize,
) -> Result<MastNodeId, DeserializationError>;
// Provided methods
fn node_info_at(
&self,
index: usize,
) -> Result<MastNodeInfo, DeserializationError> { ... }
fn is_empty(&self) -> bool { ... }
fn has_node(&self, index: usize) -> bool { ... }
fn all_node_infos(&self) -> Result<Vec<MastNodeInfo>, DeserializationError> { ... }
fn procedure_roots(&self) -> Result<Vec<MastNodeId>, DeserializationError> { ... }
}Expand description
Read-only view over serialization-oriented MAST node metadata.
This trait lives alongside super::SerializedMastForest because its surface is defined in
terms of serialized-equivalent node entries and digests, even though both
super::SerializedMastForest and in-memory crate::mast::MastForest implement it.
Required Methods§
Sourcefn node_count(&self) -> usize
fn node_count(&self) -> usize
Returns the number of nodes in the forest.
Sourcefn node_entry_at(
&self,
index: usize,
) -> Result<MastNodeEntry, DeserializationError>
fn node_entry_at( &self, index: usize, ) -> Result<MastNodeEntry, DeserializationError>
Returns fixed-width structural metadata for a node at the specified index.
Returns an error if index >= self.node_count().
Sourcefn node_digest_at(&self, index: usize) -> Result<Word, DeserializationError>
fn node_digest_at(&self, index: usize) -> Result<Word, DeserializationError>
Returns the digest of the node at the specified index.
Returns an error if index >= self.node_count().
Sourcefn procedure_root_count(&self) -> usize
fn procedure_root_count(&self) -> usize
Returns the number of procedure roots in the forest.
Sourcefn procedure_root_at(
&self,
index: usize,
) -> Result<MastNodeId, DeserializationError>
fn procedure_root_at( &self, index: usize, ) -> Result<MastNodeId, DeserializationError>
Returns the procedure root id at the specified index.
Returns an error if index >= self.procedure_root_count().
Provided Methods§
Sourcefn node_info_at(
&self,
index: usize,
) -> Result<MastNodeInfo, DeserializationError>
fn node_info_at( &self, index: usize, ) -> Result<MastNodeInfo, DeserializationError>
Returns serialized-equivalent metadata for a node at the specified index.
Returns an error if index >= self.node_count().
Sourcefn all_node_infos(&self) -> Result<Vec<MastNodeInfo>, DeserializationError>
fn all_node_infos(&self) -> Result<Vec<MastNodeInfo>, DeserializationError>
Returns all node infos in index order.
Sourcefn procedure_roots(&self) -> Result<Vec<MastNodeId>, DeserializationError>
fn procedure_roots(&self) -> Result<Vec<MastNodeId>, DeserializationError>
Returns all procedure roots in index order.