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.

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§

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

Source§

fn base_hugr(&self) -> &Hugr

Source§

fn root_node(&self) -> Node

Source§

impl<T: HugrInternals> HugrInternals for &T

Source§

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

Source§

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

Source§

fn base_hugr(&self) -> &Hugr

Source§

fn root_node(&self) -> Node

Source§

impl<T: HugrInternals> HugrInternals for &mut T

Source§

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

Source§

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

Source§

fn base_hugr(&self) -> &Hugr

Source§

fn root_node(&self) -> Node

Source§

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

Source§

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

Source§

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

Source§

fn base_hugr(&self) -> &Hugr

Source§

fn root_node(&self) -> Node

Source§

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

Source§

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

Source§

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

Source§

fn base_hugr(&self) -> &Hugr

Source§

fn root_node(&self) -> Node

Source§

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

Source§

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

Source§

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

Source§

fn base_hugr(&self) -> &Hugr

Source§

fn root_node(&self) -> Node

Implementors§

Source§

impl HugrInternals for Hugr

Source§

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

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<H: AsRef<Hugr>, Root> HugrInternals for RootChecked<H, Root>

Source§

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