Trait HugrInternals

Source
pub trait HugrInternals {
    type Portgraph<'p>: LinkView + Clone + 'p
       where Self: 'p;
    type Node: Copy + Ord + Debug + Display + Hash;

    // Required methods
    fn portgraph(&self) -> Self::Portgraph<'_>;
    fn base_hugr(&self) -> &Hugr;
    fn root_node(&self) -> Self::Node;
    fn get_pg_index(&self, node: Self::Node) -> NodeIndex;
    fn get_node(&self, index: NodeIndex) -> Self::Node;
}
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 Portgraph<'p>: LinkView + Clone + 'p where Self: 'p

The underlying portgraph view type.

Source

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

The type of nodes in the Hugr.

Required Methods§

Source

fn portgraph(&self) -> Self::Portgraph<'_>

Returns a reference to the underlying portgraph.

Source

fn base_hugr(&self) -> &Hugr

Returns the Hugr at the base of a chain of views.

Source

fn root_node(&self) -> Self::Node

Return the root node of this view.

Source

fn get_pg_index(&self, node: Self::Node) -> NodeIndex

Convert a node to a portgraph node index.

Source

fn get_node(&self, index: NodeIndex) -> Self::Node

Convert a portgraph node index to a node.

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: HugrInternals + ToOwned> HugrInternals for Cow<'_, T>

Source§

type Portgraph<'p> = <T as HugrInternals>::Portgraph<'p> where Self: 'p

Source§

type Node = <T as HugrInternals>::Node

Source§

fn portgraph(&self) -> Self::Portgraph<'_>

Source§

fn base_hugr(&self) -> &Hugr

Source§

fn root_node(&self) -> Self::Node

Source§

fn get_pg_index(&self, node: Self::Node) -> NodeIndex

Source§

fn get_node(&self, index: NodeIndex) -> Self::Node

Source§

impl<T: HugrInternals> HugrInternals for &T

Source§

type Portgraph<'p> = <T as HugrInternals>::Portgraph<'p> where Self: 'p

Source§

type Node = <T as HugrInternals>::Node

Source§

fn portgraph(&self) -> Self::Portgraph<'_>

Source§

fn base_hugr(&self) -> &Hugr

Source§

fn root_node(&self) -> Self::Node

Source§

fn get_pg_index(&self, node: Self::Node) -> NodeIndex

Source§

fn get_node(&self, index: NodeIndex) -> Self::Node

Source§

impl<T: HugrInternals> HugrInternals for &mut T

Source§

type Portgraph<'p> = <T as HugrInternals>::Portgraph<'p> where Self: 'p

Source§

type Node = <T as HugrInternals>::Node

Source§

fn portgraph(&self) -> Self::Portgraph<'_>

Source§

fn base_hugr(&self) -> &Hugr

Source§

fn root_node(&self) -> Self::Node

Source§

fn get_pg_index(&self, node: Self::Node) -> NodeIndex

Source§

fn get_node(&self, index: NodeIndex) -> Self::Node

Source§

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

Source§

type Portgraph<'p> = <T as HugrInternals>::Portgraph<'p> where Self: 'p

Source§

type Node = <T as HugrInternals>::Node

Source§

fn portgraph(&self) -> Self::Portgraph<'_>

Source§

fn base_hugr(&self) -> &Hugr

Source§

fn root_node(&self) -> Self::Node

Source§

fn get_pg_index(&self, node: Self::Node) -> NodeIndex

Source§

fn get_node(&self, index: NodeIndex) -> Self::Node

Source§

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

Source§

type Portgraph<'p> = <T as HugrInternals>::Portgraph<'p> where Self: 'p

Source§

type Node = <T as HugrInternals>::Node

Source§

fn portgraph(&self) -> Self::Portgraph<'_>

Source§

fn base_hugr(&self) -> &Hugr

Source§

fn root_node(&self) -> Self::Node

Source§

fn get_pg_index(&self, node: Self::Node) -> NodeIndex

Source§

fn get_node(&self, index: NodeIndex) -> Self::Node

Source§

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

Source§

type Portgraph<'p> = <T as HugrInternals>::Portgraph<'p> where Self: 'p

Source§

type Node = <T as HugrInternals>::Node

Source§

fn portgraph(&self) -> Self::Portgraph<'_>

Source§

fn base_hugr(&self) -> &Hugr

Source§

fn root_node(&self) -> Self::Node

Source§

fn get_pg_index(&self, node: Self::Node) -> NodeIndex

Source§

fn get_node(&self, index: NodeIndex) -> Self::Node

Implementors§

Source§

impl HugrInternals for Hugr

Source§

type Portgraph<'p> = &'p MultiPortGraph where Self: 'p

Source§

type Node = Node

Source§

impl<'g, Root> HugrInternals for DescendantsGraph<'g, Root>
where Root: NodeHandle,

Source§

type Portgraph<'p> = &'p Region<'g, &'g MultiPortGraph> where Self: 'p

Source§

type Node = Node

Source§

impl<'g, Root> HugrInternals for SiblingGraph<'g, Root>
where Root: NodeHandle,

Source§

type Portgraph<'p> = &'p FlatRegion<'g, &'g MultiPortGraph> where Self: 'p

Source§

type Node = Node

Source§

impl<'g, Root: NodeHandle> HugrInternals for SiblingMut<'g, Root>

Source§

type Portgraph<'p> = FlatRegion<'p, &'p MultiPortGraph> where Root: 'p, 'g: 'p

Source§

type Node = Node

Source§

impl<H: AsRef<Hugr>, Root> HugrInternals for RootChecked<H, Root>

Source§

type Portgraph<'p> = &'p MultiPortGraph where Self: 'p

Source§

type Node = Node