Skip to main content

MastForestView

Trait MastForestView 

Source
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§

Source

fn node_count(&self) -> usize

Returns the number of nodes in the forest.

Source

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().

Source

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().

Source

fn procedure_root_count(&self) -> usize

Returns the number of procedure roots in the forest.

Source

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§

Source

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().

Source

fn is_empty(&self) -> bool

Returns true when the forest contains no nodes.

Source

fn has_node(&self, index: usize) -> bool

Returns true when index is a valid node index.

Source

fn all_node_infos(&self) -> Result<Vec<MastNodeInfo>, DeserializationError>

Returns all node infos in index order.

Source

fn procedure_roots(&self) -> Result<Vec<MastNodeId>, DeserializationError>

Returns all procedure roots in index order.

Implementors§