Skip to main content

MastForestContributor

Trait MastForestContributor 

pub trait MastForestContributor {
    // Required methods
    fn add_to_forest(
        self,
        forest: &mut MastForest,
    ) -> Result<MastNodeId, MastForestError>;
    fn fingerprint_for_node(
        &self,
        forest: &MastForest,
        hash_by_node_id: &impl LookupByIdx<MastNodeId, MastNodeFingerprint>,
    ) -> Result<MastNodeFingerprint, MastForestError>;
    fn remap_children(
        self,
        remapping: &impl LookupByIdx<MastNodeId, MastNodeId>,
    ) -> Self;
    fn with_before_enter(self, _decorators: impl Into<Vec<DecoratorId>>) -> Self;
    fn with_after_exit(self, _decorators: impl Into<Vec<DecoratorId>>) -> Self;
    fn append_before_enter(
        &mut self,
        decorators: impl IntoIterator<Item = DecoratorId>,
    );
    fn append_after_exit(
        &mut self,
        decorators: impl IntoIterator<Item = DecoratorId>,
    );
    fn with_digest(self, digest: Word) -> Self;
}

Required Methods§

fn add_to_forest( self, forest: &mut MastForest, ) -> Result<MastNodeId, MastForestError>

fn fingerprint_for_node( &self, forest: &MastForest, hash_by_node_id: &impl LookupByIdx<MastNodeId, MastNodeFingerprint>, ) -> Result<MastNodeFingerprint, MastForestError>

Returns the fingerprint for this builder without constructing a MastNode.

This method computes the fingerprint for a node directly from the builder data without first constructing a MastNode, providing the same result as the traditional fingerprint computation approach.

fn remap_children( self, remapping: &impl LookupByIdx<MastNodeId, MastNodeId>, ) -> Self

Remap the node children to their new positions indicated by the given lookup.

fn with_before_enter(self, _decorators: impl Into<Vec<DecoratorId>>) -> Self

Adds decorators to be executed before this node.

fn with_after_exit(self, _decorators: impl Into<Vec<DecoratorId>>) -> Self

Adds decorators to be executed after this node.

fn append_before_enter( &mut self, decorators: impl IntoIterator<Item = DecoratorId>, )

Appends decorators to be executed before this node.

Unlike with_before_enter, this method adds to the existing list of decorators rather than replacing them.

fn append_after_exit( &mut self, decorators: impl IntoIterator<Item = DecoratorId>, )

Appends decorators to be executed after this node.

Unlike with_after_exit, this method adds to the existing list of decorators rather than replacing them.

fn with_digest(self, digest: Word) -> Self

Sets a digest to be forced into the built node.

When a digest is set, the builder will use this digest instead of computing the normal digest for the node during the build() operation.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§