Trait PatchVerification

Source
pub trait PatchVerification {
    type Error: Error;
    type Node: HugrNode;

    // Required methods
    fn verify(
        &self,
        h: &impl HugrView<Node = Self::Node>,
    ) -> Result<(), Self::Error>;
    fn invalidation_set(&self) -> impl Iterator<Item = Self::Node>;
}
Expand description

Verify that a patch application would succeed.

Required Associated Types§

Source

type Error: Error

The type of Error with which this Rewrite may fail

Source

type Node: HugrNode

The node type of the HugrView that this patch applies to.

Required Methods§

Source

fn verify( &self, h: &impl HugrView<Node = Self::Node>, ) -> Result<(), Self::Error>

Checks whether the rewrite would succeed on the specified Hugr. If this call succeeds, Patch::apply should also succeed on the same h If this calls fails, Patch::apply would fail with the same error.

Source

fn invalidation_set(&self) -> impl Iterator<Item = Self::Node>

Returns a set of nodes referenced by the rewrite. Modifying any of these nodes will invalidate it.

Two impl Rewrites can be composed if their invalidation sets are disjoint.

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§