Trait HugrInternals

Source
pub trait HugrInternals {
    type RegionPortgraph<'p>: LinkView<LinkEndpoint: Eq> + Clone + 'p
       where Self: 'p;
    type Node: Copy + Ord + Debug + Display + Hash;
    type RegionPortgraphNodes: PortgraphNodeMap<Self::Node>;

    // Required methods
    fn region_portgraph(
        &self,
        parent: Self::Node,
    ) -> (FlatRegion<'_, Self::RegionPortgraph<'_>>, Self::RegionPortgraphNodes);
    fn node_metadata_map(&self, node: Self::Node) -> &NodeMetadataMap;
}
Expand description

Trait for accessing the internals of a Hugr(View).

Specifically, this trait provides access to the underlying portgraph view.

Required Associated Types§

Source

type RegionPortgraph<'p>: LinkView<LinkEndpoint: Eq> + Clone + 'p where Self: 'p

The portgraph graph structure returned by HugrInternals::region_portgraph.

Source

type Node: Copy + Ord + Debug + Display + Hash

The type of nodes in the Hugr.

Source

type RegionPortgraphNodes: PortgraphNodeMap<Self::Node>

A mapping between HUGR nodes and portgraph nodes in the graph returned by HugrInternals::region_portgraph.

Required Methods§

Source

fn region_portgraph( &self, parent: Self::Node, ) -> (FlatRegion<'_, Self::RegionPortgraph<'_>>, Self::RegionPortgraphNodes)

Returns a flat portgraph view of a region in the HUGR, and a mapping between HUGR nodes and portgraph nodes in the graph.

Source

fn node_metadata_map(&self, node: Self::Node) -> &NodeMetadataMap

Returns a metadata entry associated with a node.

§Panics

If the node is not in the 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.

Implementations on Foreign Types§

Source§

impl<T: HugrView + ToOwned> HugrInternals for Cow<'_, T>

Source§

impl<T: HugrView> HugrInternals for &T

Source§

impl<T: HugrView> HugrInternals for &mut T

Source§

impl<T: HugrView> HugrInternals for Box<T>

Source§

impl<T: HugrView> HugrInternals for Rc<T>

Source§

impl<T: HugrView> HugrInternals for Arc<T>

Implementors§