hugr_core::hugr::internal

Trait HugrInternals

Source
pub trait HugrInternals {
    type Portgraph<'p>: LinkView + Clone + 'p
       where Self: 'p;

    // Required methods
    fn portgraph(&self) -> Self::Portgraph<'_>;
    fn base_hugr(&self) -> &Hugr;
    fn root_node(&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.

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) -> Node

Return the root node of this view.

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§

Source§

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

Source§

type Portgraph<'p> = &'p FilteredGraph<&'g MultiPortGraph, fn(_: NodeIndex, _: &RegionContext<'g>) -> bool, fn(_: PortIndex, _: &RegionContext<'g>) -> bool, RegionContext<'g>> where Self: 'p

Source§

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

Source§

type Portgraph<'p> = &'p FilteredGraph<&'g MultiPortGraph, fn(_: NodeIndex, _: &(&'g Hierarchy, NodeIndex)) -> bool, fn(_: PortIndex, _: &(&'g Hierarchy, NodeIndex)) -> bool, (&'g Hierarchy, NodeIndex)> where Self: 'p

Source§

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

Source§

type Portgraph<'p> = FilteredGraph<&'p MultiPortGraph, fn(_: NodeIndex, _: &(&'p Hierarchy, NodeIndex)) -> bool, fn(_: PortIndex, _: &(&'p Hierarchy, NodeIndex)) -> bool, (&'p Hierarchy, NodeIndex)> where Root: 'p, 'g: 'p

Source§

impl<T: AsRef<Hugr>> HugrInternals for T

Source§

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