Trait PortgraphNodeMap

Source
pub trait PortgraphNodeMap<N>:
    Clone
    + Sized
    + Debug {
    // Required methods
    fn to_portgraph(&self, node: N) -> NodeIndex;
    fn from_portgraph(&self, node: NodeIndex) -> N;
}
Expand description

A map between hugr nodes and portgraph nodes in the graph returned by HugrInternals::region_portgraph.

Required Methods§

Source

fn to_portgraph(&self, node: N) -> NodeIndex

Returns the portgraph index of a HUGR node in the associated region graph.

If the node is not in the region, the result is undefined.

Source

fn from_portgraph(&self, node: NodeIndex) -> N

Returns the HUGR node for a portgraph node in the associated region graph.

If the node is not in the region, the result is undefined.

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.

Implementations on Foreign Types§

Source§

impl<N: HugrNode> PortgraphNodeMap<N> for HashMap<N, Node>

Source§

fn to_portgraph(&self, node: N) -> NodeIndex

Source§

fn from_portgraph(&self, node: NodeIndex) -> N

Implementors§