HugrLinking

Trait HugrLinking 

Source
pub trait HugrLinking: HugrMut {
    // Provided methods
    fn insert_link_view_by_node<H: HugrView>(
        &mut self,
        parent: Option<Self::Node>,
        other: &H,
        children: NodeLinkingDirectives<H::Node, Self::Node>,
    ) -> Result<InsertedForest<H::Node, Self::Node>, NodeLinkingError<H::Node, Self::Node>> { ... }
    fn insert_link_hugr_by_node(
        &mut self,
        parent: Option<Self::Node>,
        other: Hugr,
        children: NodeLinkingDirectives<Node, Self::Node>,
    ) -> Result<InsertedForest<Node, Self::Node>, NodeLinkingError<Node, Self::Node>> { ... }
}
Expand description

Methods that merge Hugrs, adding static edges between old and inserted nodes.

This is done by module-children from the inserted (source) Hugr replacing, or being replaced by, module-children already in the target Hugr; static edges from the replaced node, are transferred to come from the replacing node, and the replaced node(/subtree) then deleted.

Provided Methods§

Copy and link nodes from another Hugr into this one, with linking specified by Node.

If parent is non-None, then other’s entrypoint-subtree is copied under it. children of the Module root of other may also be inserted with their subtrees or linked according to their NodeLinkingDirective.

§Errors
  • If children are not children of the root of other
  • If parent is Some, and other.entrypoint() is either
§Panics

If parent is Some but not in the graph.

Insert and link another Hugr into this one, with linking specified by Node.

If parent is non-None, then other’s entrypoint-subtree is placed under it. children of the Module root of other may also be inserted with their subtrees or linked according to their NodeLinkingDirective.

§Errors
  • If children are not children of the root of other
  • If others entrypoint is among children, or descends from an element of children with NodeLinkingDirective::Add
§Panics

If parent is not in this graph.

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§