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§
Sourcefn 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_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>>
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
childrenare notchildrenof the root ofother - If
parentis Some, andother.entrypoint()is either- among
children, or - descends from an element of
childrenwith NodeLinkingDirective::Add
- among
§Panics
If parent is Some but not in the graph.
Sourcefn 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>>
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>>
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
childrenare notchildrenof the root ofother - If
others entrypoint is amongchildren, or descends from an element ofchildrenwith 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.