pub trait HugrView: HugrInternals {
Show 56 methods
// Required methods
fn entrypoint(&self) -> Self::Node;
fn module_root(&self) -> Self::Node;
fn contains_node(&self, node: Self::Node) -> bool;
fn get_parent(&self, node: Self::Node) -> Option<Self::Node>;
fn get_optype(&self, node: Self::Node) -> &OpType;
fn num_nodes(&self) -> usize;
fn num_edges(&self) -> usize;
fn num_ports(&self, node: Self::Node, dir: Direction) -> usize;
fn nodes(&self) -> impl Iterator<Item = Self::Node> + Clone;
fn node_ports(
&self,
node: Self::Node,
dir: Direction,
) -> impl Iterator<Item = Port> + Clone;
fn all_node_ports(
&self,
node: Self::Node,
) -> impl Iterator<Item = Port> + Clone;
fn linked_ports(
&self,
node: Self::Node,
port: impl Into<Port>,
) -> impl Iterator<Item = (Self::Node, Port)> + Clone;
fn node_connections(
&self,
node: Self::Node,
other: Self::Node,
) -> impl Iterator<Item = [Port; 2]> + Clone;
fn children(
&self,
node: Self::Node,
) -> impl DoubleEndedIterator<Item = Self::Node> + Clone;
fn descendants(
&self,
node: Self::Node,
) -> impl Iterator<Item = Self::Node> + Clone;
fn neighbours(
&self,
node: Self::Node,
dir: Direction,
) -> impl Iterator<Item = Self::Node> + Clone;
fn all_neighbours(
&self,
node: Self::Node,
) -> impl Iterator<Item = Self::Node> + Clone;
fn mermaid_string_with_config(
&self,
config: RenderConfig<Self::Node>,
) -> String;
fn dot_string(&self) -> String
where Self: Sized;
fn extensions(&self) -> &ExtensionRegistry;
fn extract_hugr(
&self,
parent: Self::Node,
) -> (Hugr, impl ExtractionResult<Self::Node> + 'static);
// Provided methods
fn entrypoint_optype(&self) -> &OpType { ... }
fn entrypoint_tag(&self) -> OpTag { ... }
fn with_entrypoint(&self, entrypoint: Self::Node) -> Rerooted<&Self>
where Self: Sized { ... }
fn get_metadata(
&self,
node: Self::Node,
key: impl AsRef<str>,
) -> Option<&NodeMetadata> { ... }
fn num_inputs(&self, node: Self::Node) -> usize { ... }
fn num_outputs(&self, node: Self::Node) -> usize { ... }
fn node_outputs(
&self,
node: Self::Node,
) -> impl Iterator<Item = OutgoingPort> + Clone { ... }
fn node_inputs(
&self,
node: Self::Node,
) -> impl Iterator<Item = IncomingPort> + Clone { ... }
fn all_linked_ports(
&self,
node: Self::Node,
dir: Direction,
) -> Either<impl Iterator<Item = (Self::Node, OutgoingPort)>, impl Iterator<Item = (Self::Node, IncomingPort)>> ⓘ { ... }
fn all_linked_outputs(
&self,
node: Self::Node,
) -> impl Iterator<Item = (Self::Node, OutgoingPort)> { ... }
fn all_linked_inputs(
&self,
node: Self::Node,
) -> impl Iterator<Item = (Self::Node, IncomingPort)> { ... }
fn single_linked_port(
&self,
node: Self::Node,
port: impl Into<Port>,
) -> Option<(Self::Node, Port)> { ... }
fn single_linked_output(
&self,
node: Self::Node,
port: impl Into<IncomingPort>,
) -> Option<(Self::Node, OutgoingPort)> { ... }
fn single_linked_input(
&self,
node: Self::Node,
port: impl Into<OutgoingPort>,
) -> Option<(Self::Node, IncomingPort)> { ... }
fn linked_outputs(
&self,
node: Self::Node,
port: impl Into<IncomingPort>,
) -> impl Iterator<Item = (Self::Node, OutgoingPort)> { ... }
fn linked_inputs(
&self,
node: Self::Node,
port: impl Into<OutgoingPort>,
) -> impl Iterator<Item = (Self::Node, IncomingPort)> { ... }
fn is_linked(&self, node: Self::Node, port: impl Into<Port>) -> bool { ... }
fn entry_descendants(&self) -> impl Iterator<Item = Self::Node> + Clone { ... }
fn first_child(&self, node: Self::Node) -> Option<Self::Node> { ... }
fn input_neighbours(
&self,
node: Self::Node,
) -> impl Iterator<Item = Self::Node> + Clone { ... }
fn output_neighbours(
&self,
node: Self::Node,
) -> impl Iterator<Item = Self::Node> + Clone { ... }
fn get_io(&self, node: Self::Node) -> Option<[Self::Node; 2]> { ... }
fn inner_function_type(&self) -> Option<Cow<'_, Signature>> { ... }
fn poly_func_type(&self) -> Option<PolyFuncType> { ... }
fn as_petgraph(&self) -> PetgraphWrapper<'_, Self>
where Self: Sized { ... }
fn mermaid_string(&self) -> String { ... }
fn mermaid_string_with_formatter(
&self,
formatter: MermaidFormatter<'_, Self>,
) -> String { ... }
fn mermaid_format(&self) -> MermaidFormatter<'_, Self> { ... }
fn static_source(&self, node: Self::Node) -> Option<Self::Node> { ... }
fn static_targets(
&self,
node: Self::Node,
) -> Option<impl Iterator<Item = (Self::Node, IncomingPort)>> { ... }
fn signature(&self, node: Self::Node) -> Option<Cow<'_, Signature>> { ... }
fn value_types(
&self,
node: Self::Node,
dir: Direction,
) -> impl Iterator<Item = (Port, Type)> { ... }
fn in_value_types(
&self,
node: Self::Node,
) -> impl Iterator<Item = (IncomingPort, Type)> { ... }
fn out_value_types(
&self,
node: Self::Node,
) -> impl Iterator<Item = (OutgoingPort, Type)> { ... }
fn validate(&self) -> Result<(), ValidationError<Self::Node>>
where Self: Sized { ... }
}
Expand description
A trait for inspecting HUGRs. For end users we intend this to be superseded by region-specific APIs.
Required Methods§
Sourcefn entrypoint(&self) -> Self::Node
fn entrypoint(&self) -> Self::Node
The distinguished node from where operations are applied, commonly defining a region of interest.
This node represents the execution entrypoint of the HUGR. When running local graph analysis or optimizations, the region defined under this node will be used as the starting point.
Sourcefn module_root(&self) -> Self::Node
fn module_root(&self) -> Self::Node
A pointer to the module region defined at the root of the HUGR.
This node is the root node of the node hierarchy. It is the ancestor of all other nodes in the HUGR.
Operations applied to a hugr normally start at the
HugrView::entrypoint
instead.
Sourcefn contains_node(&self, node: Self::Node) -> bool
fn contains_node(&self, node: Self::Node) -> bool
Returns true
if the node exists in the HUGR.
Sourcefn get_parent(&self, node: Self::Node) -> Option<Self::Node>
fn get_parent(&self, node: Self::Node) -> Option<Self::Node>
Returns the parent of a node.
Sourcefn get_optype(&self, node: Self::Node) -> &OpType
fn get_optype(&self, node: Self::Node) -> &OpType
Sourcefn num_ports(&self, node: Self::Node, dir: Direction) -> usize
fn num_ports(&self, node: Self::Node, dir: Direction) -> usize
Number of ports in node for a given direction.
Sourcefn nodes(&self) -> impl Iterator<Item = Self::Node> + Clone
fn nodes(&self) -> impl Iterator<Item = Self::Node> + Clone
Iterates over the all the nodes in the HUGR.
This iterator returns every node in the HUGR. In most cases, you will
want to use HugrView::entry_descendants
instead to get the nodes
that are reachable from the entrypoint.
See also HugrView::descendants
and HugrView::children
for more
general iterators.
Sourcefn node_ports(
&self,
node: Self::Node,
dir: Direction,
) -> impl Iterator<Item = Port> + Clone
fn node_ports( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Port> + Clone
Iterator over ports of node in a given direction.
Sourcefn all_node_ports(&self, node: Self::Node) -> impl Iterator<Item = Port> + Clone
fn all_node_ports(&self, node: Self::Node) -> impl Iterator<Item = Port> + Clone
Iterator over both the input and output ports of node.
Sourcefn linked_ports(
&self,
node: Self::Node,
port: impl Into<Port>,
) -> impl Iterator<Item = (Self::Node, Port)> + Clone
fn linked_ports( &self, node: Self::Node, port: impl Into<Port>, ) -> impl Iterator<Item = (Self::Node, Port)> + Clone
Iterator over the nodes and ports connected to a port.
Sourcefn node_connections(
&self,
node: Self::Node,
other: Self::Node,
) -> impl Iterator<Item = [Port; 2]> + Clone
fn node_connections( &self, node: Self::Node, other: Self::Node, ) -> impl Iterator<Item = [Port; 2]> + Clone
Iterator the links between two nodes.
Sourcefn children(
&self,
node: Self::Node,
) -> impl DoubleEndedIterator<Item = Self::Node> + Clone
fn children( &self, node: Self::Node, ) -> impl DoubleEndedIterator<Item = Self::Node> + Clone
Returns an iterator over the direct children of node.
Sourcefn descendants(
&self,
node: Self::Node,
) -> impl Iterator<Item = Self::Node> + Clone
fn descendants( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone
Returns an iterator over all the descendants of a node, including the node itself.
Yields the node itself first, followed by its children in breath-first order.
Sourcefn neighbours(
&self,
node: Self::Node,
dir: Direction,
) -> impl Iterator<Item = Self::Node> + Clone
fn neighbours( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Self::Node> + Clone
Iterates over neighbour nodes in the given direction. May contain duplicates if the graph has multiple links between nodes.
Sourcefn all_neighbours(
&self,
node: Self::Node,
) -> impl Iterator<Item = Self::Node> + Clone
fn all_neighbours( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone
Iterates over the input and output neighbours of the node
in sequence.
Sourcefn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String
👎Deprecated: Use mermaid_format
instead
fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String
mermaid_format
insteadReturn the mermaid representation of the underlying hierarchical graph.
The hierarchy is represented using subgraphs. Edges are labelled with their source and target ports.
For a more detailed representation, use the HugrView::dot_string
format instead.
Sourcefn dot_string(&self) -> Stringwhere
Self: Sized,
fn dot_string(&self) -> Stringwhere
Self: Sized,
Return the graphviz representation of the underlying graph and hierarchy side by side.
For a simpler representation, use the HugrView::mermaid_string
format instead.
Sourcefn extensions(&self) -> &ExtensionRegistry
fn extensions(&self) -> &ExtensionRegistry
Returns the set of extensions used by the HUGR.
This set contains all extensions required to define the operations and types in the HUGR.
Sourcefn extract_hugr(
&self,
parent: Self::Node,
) -> (Hugr, impl ExtractionResult<Self::Node> + 'static)
fn extract_hugr( &self, parent: Self::Node, ) -> (Hugr, impl ExtractionResult<Self::Node> + 'static)
Extracts a HUGR containing the parent node and all its descendants.
Returns a new HUGR and a map from the nodes in the source HUGR to the
nodes in the extracted HUGR. The new HUGR entrypoint corresponds to the
extracted parent
node.
Edges that connected to nodes outside the parent node are not included in the new HUGR.
If the parent is not a module, the returned HUGR will contain some additional nodes to contain the new entrypoint. E.g. if the optype must be contained in a dataflow region, a module with a function definition will be created to contain it.
Provided Methods§
Sourcefn entrypoint_optype(&self) -> &OpType
fn entrypoint_optype(&self) -> &OpType
Returns the operation type of the entrypoint node.
Sourcefn entrypoint_tag(&self) -> OpTag
fn entrypoint_tag(&self) -> OpTag
An operation tag that is guaranteed to represent the
HugrView::entrypoint
node operation.
The specificity of the tag may vary depending on the HUGR view.
OpTag::Any
may be returned for any node, but more specific tags may
be used instead.
The tag returned may vary if the entrypoint node’s operation is modified, or if the entrypoint node is replaced with another node.
Sourcefn with_entrypoint(&self, entrypoint: Self::Node) -> Rerooted<&Self>where
Self: Sized,
fn with_entrypoint(&self, entrypoint: Self::Node) -> Rerooted<&Self>where
Self: Sized,
Returns a non-mutable view of the HUGR with a different entrypoint.
For a mutable view, use HugrMut::with_entrypoint_mut
instead.
§Panics
Panics if the entrypoint node is not valid in the HUGR.
Sourcefn get_metadata(
&self,
node: Self::Node,
key: impl AsRef<str>,
) -> Option<&NodeMetadata>
fn get_metadata( &self, node: Self::Node, key: impl AsRef<str>, ) -> Option<&NodeMetadata>
Returns the metadata associated with a node.
Sourcefn num_inputs(&self, node: Self::Node) -> usize
fn num_inputs(&self, node: Self::Node) -> usize
Number of inputs to a node.
Shorthand for num_ports
(node, Direction::Incoming)
.
Sourcefn num_outputs(&self, node: Self::Node) -> usize
fn num_outputs(&self, node: Self::Node) -> usize
Number of outputs from a node.
Shorthand for num_ports
(node, Direction::Outgoing)
.
Sourcefn node_outputs(
&self,
node: Self::Node,
) -> impl Iterator<Item = OutgoingPort> + Clone
fn node_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = OutgoingPort> + Clone
Iterator over output ports of node.
Like node_ports
(node, Direction::Outgoing)
but preserves knowledge that the ports are OutgoingPort
s.
Sourcefn node_inputs(
&self,
node: Self::Node,
) -> impl Iterator<Item = IncomingPort> + Clone
fn node_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = IncomingPort> + Clone
Iterator over inputs ports of node.
Like node_ports
(node, Direction::Incoming)
but preserves knowledge that the ports are IncomingPort
s.
Sourcefn all_linked_ports(
&self,
node: Self::Node,
dir: Direction,
) -> Either<impl Iterator<Item = (Self::Node, OutgoingPort)>, impl Iterator<Item = (Self::Node, IncomingPort)>> ⓘ
fn all_linked_ports( &self, node: Self::Node, dir: Direction, ) -> Either<impl Iterator<Item = (Self::Node, OutgoingPort)>, impl Iterator<Item = (Self::Node, IncomingPort)>> ⓘ
Iterator over all the nodes and ports connected to a node in a given direction.
Sourcefn all_linked_outputs(
&self,
node: Self::Node,
) -> impl Iterator<Item = (Self::Node, OutgoingPort)>
fn all_linked_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>
Iterator over all the nodes and ports connected to a node’s inputs.
Sourcefn all_linked_inputs(
&self,
node: Self::Node,
) -> impl Iterator<Item = (Self::Node, IncomingPort)>
fn all_linked_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>
Iterator over all the nodes and ports connected to a node’s outputs.
Sourcefn single_linked_port(
&self,
node: Self::Node,
port: impl Into<Port>,
) -> Option<(Self::Node, Port)>
fn single_linked_port( &self, node: Self::Node, port: impl Into<Port>, ) -> Option<(Self::Node, Port)>
If there is exactly one port connected to this port, return it and its node.
Sourcefn single_linked_output(
&self,
node: Self::Node,
port: impl Into<IncomingPort>,
) -> Option<(Self::Node, OutgoingPort)>
fn single_linked_output( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> Option<(Self::Node, OutgoingPort)>
If there is exactly one OutgoingPort
connected to this IncomingPort
, return
it and its node.
Sourcefn single_linked_input(
&self,
node: Self::Node,
port: impl Into<OutgoingPort>,
) -> Option<(Self::Node, IncomingPort)>
fn single_linked_input( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> Option<(Self::Node, IncomingPort)>
If there is exactly one IncomingPort
connected to this OutgoingPort
, return
it and its node.
Sourcefn linked_outputs(
&self,
node: Self::Node,
port: impl Into<IncomingPort>,
) -> impl Iterator<Item = (Self::Node, OutgoingPort)>
fn linked_outputs( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>
Iterator over the nodes and output ports connected to a given input port.
Like linked_ports
but preserves knowledge
that the linked ports are OutgoingPort
s.
Sourcefn linked_inputs(
&self,
node: Self::Node,
port: impl Into<OutgoingPort>,
) -> impl Iterator<Item = (Self::Node, IncomingPort)>
fn linked_inputs( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>
Iterator over the nodes and input ports connected to a given output port
Like linked_ports
but preserves knowledge
that the linked ports are IncomingPort
s.
Sourcefn is_linked(&self, node: Self::Node, port: impl Into<Port>) -> bool
fn is_linked(&self, node: Self::Node, port: impl Into<Port>) -> bool
Returns whether a port is connected.
Sourcefn entry_descendants(&self) -> impl Iterator<Item = Self::Node> + Clone
fn entry_descendants(&self) -> impl Iterator<Item = Self::Node> + Clone
Returns an iterator over all the descendants of the hugr entrypoint, including the node itself.
Yields the node itself first, followed by its children in breath-first order.
Sourcefn first_child(&self, node: Self::Node) -> Option<Self::Node>
fn first_child(&self, node: Self::Node) -> Option<Self::Node>
Returns the first child of the specified node (if it is a parent).
Useful because x.children().next()
leaves x borrowed.
Sourcefn input_neighbours(
&self,
node: Self::Node,
) -> impl Iterator<Item = Self::Node> + Clone
fn input_neighbours( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone
Iterates over the input neighbours of the node
.
Shorthand for neighbours
(node, Direction::Incoming)
.
Sourcefn output_neighbours(
&self,
node: Self::Node,
) -> impl Iterator<Item = Self::Node> + Clone
fn output_neighbours( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone
Iterates over the output neighbours of the node
.
Shorthand for neighbours
(node, Direction::Outgoing)
.
Sourcefn get_io(&self, node: Self::Node) -> Option<[Self::Node; 2]>
fn get_io(&self, node: Self::Node) -> Option<[Self::Node; 2]>
Get the input and output child nodes of a dataflow parent. If the node isn’t a dataflow parent, then return None
Sourcefn inner_function_type(&self) -> Option<Cow<'_, Signature>>
fn inner_function_type(&self) -> Option<Cow<'_, Signature>>
Returns the function type defined by this dataflow HUGR.
If the root of the Hugr is a
DataflowParent
operation, report the
signature corresponding to the input and output node of its sibling
graph. Otherwise, returns None
.
In contrast to poly_func_type
, this
method always return a concrete Signature
.
Sourcefn poly_func_type(&self) -> Option<PolyFuncType>
fn poly_func_type(&self) -> Option<PolyFuncType>
Sourcefn as_petgraph(&self) -> PetgraphWrapper<'_, Self>where
Self: Sized,
fn as_petgraph(&self) -> PetgraphWrapper<'_, Self>where
Self: Sized,
Return a wrapper over the view that can be used in petgraph algorithms.
Sourcefn mermaid_string(&self) -> String
fn mermaid_string(&self) -> String
Return the mermaid representation of the underlying hierarchical graph.
The hierarchy is represented using subgraphs. Edges are labelled with their source and target ports.
For a more detailed representation, use the HugrView::dot_string
format instead.
Sourcefn mermaid_string_with_formatter(
&self,
formatter: MermaidFormatter<'_, Self>,
) -> String
fn mermaid_string_with_formatter( &self, formatter: MermaidFormatter<'_, Self>, ) -> String
Return the mermaid representation of the underlying hierarchical graph
according to the provided MermaidFormatter
formatting options.
The hierarchy is represented using subgraphs. Edges are labelled with their source and target ports.
For a more detailed representation, use the HugrView::dot_string
format instead.
§Deprecation of RenderConfig
While the deprecated HugrView::mermaid_string_with_config exists, this
will by default try to convert the formatter options to a RenderConfig
,
but this may panic if the configuration is not supported. Users are
encouraged to provide an implementation of this method overriding the default
and no longer rely on HugrView::mermaid_string_with_config.
Sourcefn mermaid_format(&self) -> MermaidFormatter<'_, Self>
fn mermaid_format(&self) -> MermaidFormatter<'_, Self>
Construct a mermaid representation of the underlying hierarchical graph.
Options can be set on the returned MermaidFormatter
struct, before
generating the String with MermaidFormatter::finish
.
The hierarchy is represented using subgraphs. Edges are labelled with their source and target ports.
For a more detailed representation, use the HugrView::dot_string
format instead.
Sourcefn static_source(&self, node: Self::Node) -> Option<Self::Node>
fn static_source(&self, node: Self::Node) -> Option<Self::Node>
If a node has a static input, return the source node.
Sourcefn static_targets(
&self,
node: Self::Node,
) -> Option<impl Iterator<Item = (Self::Node, IncomingPort)>>
fn static_targets( &self, node: Self::Node, ) -> Option<impl Iterator<Item = (Self::Node, IncomingPort)>>
If a node has a static output, return the targets.
Sourcefn signature(&self, node: Self::Node) -> Option<Cow<'_, Signature>>
fn signature(&self, node: Self::Node) -> Option<Cow<'_, Signature>>
Get the “signature” (incoming and outgoing types) of a node, non-Value kind ports will be missing.
Sourcefn value_types(
&self,
node: Self::Node,
dir: Direction,
) -> impl Iterator<Item = (Port, Type)>
fn value_types( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = (Port, Type)>
Iterator over all outgoing ports that have Value type, along with corresponding types.
Sourcefn in_value_types(
&self,
node: Self::Node,
) -> impl Iterator<Item = (IncomingPort, Type)>
fn in_value_types( &self, node: Self::Node, ) -> impl Iterator<Item = (IncomingPort, Type)>
Iterator over all incoming ports that have Value type, along with corresponding types.
Sourcefn out_value_types(
&self,
node: Self::Node,
) -> impl Iterator<Item = (OutgoingPort, Type)>
fn out_value_types( &self, node: Self::Node, ) -> impl Iterator<Item = (OutgoingPort, Type)>
Iterator over all outgoing ports that have Value type, along with corresponding types.
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> HugrView for Cow<'_, T>
impl<T: HugrView + ToOwned> HugrView for Cow<'_, T>
fn entrypoint(&self) -> Self::Node
fn entrypoint_optype(&self) -> &OpType
fn module_root(&self) -> Self::Node
fn contains_node(&self, node: Self::Node) -> bool
fn get_parent(&self, node: Self::Node) -> Option<Self::Node>
fn get_metadata( &self, node: Self::Node, key: impl AsRef<str>, ) -> Option<&NodeMetadata>
fn get_optype(&self, node: Self::Node) -> &OpType
fn num_nodes(&self) -> usize
fn num_edges(&self) -> usize
fn num_ports(&self, node: Self::Node, dir: Direction) -> usize
fn num_inputs(&self, node: Self::Node) -> usize
fn num_outputs(&self, node: Self::Node) -> usize
fn nodes(&self) -> impl Iterator<Item = Self::Node> + Clone
fn node_ports( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Port> + Clone
fn node_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = OutgoingPort> + Clone
fn node_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = IncomingPort> + Clone
fn all_node_ports(&self, node: Self::Node) -> impl Iterator<Item = Port> + Clone
fn linked_ports( &self, node: Self::Node, port: impl Into<Port>, ) -> impl Iterator<Item = (Self::Node, Port)> + Clone
fn all_linked_ports( &self, node: Self::Node, dir: Direction, ) -> Either<impl Iterator<Item = (Self::Node, OutgoingPort)>, impl Iterator<Item = (Self::Node, IncomingPort)>> ⓘ
fn all_linked_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>
fn all_linked_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>
fn single_linked_port( &self, node: Self::Node, port: impl Into<Port>, ) -> Option<(Self::Node, Port)>
fn single_linked_output( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> Option<(Self::Node, OutgoingPort)>
fn single_linked_input( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> Option<(Self::Node, IncomingPort)>
fn linked_outputs( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>
fn linked_inputs( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>
fn node_connections( &self, node: Self::Node, other: Self::Node, ) -> impl Iterator<Item = [Port; 2]> + Clone
fn is_linked(&self, node: Self::Node, port: impl Into<Port>) -> bool
fn children( &self, node: Self::Node, ) -> impl DoubleEndedIterator<Item = Self::Node> + Clone
fn descendants( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone
fn first_child(&self, node: Self::Node) -> Option<Self::Node>
fn neighbours( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Self::Node> + Clone
fn all_neighbours( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone
fn mermaid_string(&self) -> String
Source§fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String
fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String
mermaid_format
insteadfn mermaid_string_with_formatter( &self, formatter: MermaidFormatter<'_, Self>, ) -> String
fn dot_string(&self) -> String
fn static_source(&self, node: Self::Node) -> Option<Self::Node>
fn static_targets( &self, node: Self::Node, ) -> Option<impl Iterator<Item = (Self::Node, IncomingPort)>>
fn value_types( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = (Port, Type)>
fn extensions(&self) -> &ExtensionRegistry
fn validate(&self) -> Result<(), ValidationError<Self::Node>>
fn extract_hugr( &self, parent: Self::Node, ) -> (Hugr, impl ExtractionResult<Self::Node> + 'static)
Source§impl<T: HugrView> HugrView for &T
impl<T: HugrView> HugrView for &T
fn entrypoint(&self) -> Self::Node
fn entrypoint_optype(&self) -> &OpType
fn module_root(&self) -> Self::Node
fn contains_node(&self, node: Self::Node) -> bool
fn get_parent(&self, node: Self::Node) -> Option<Self::Node>
fn get_metadata( &self, node: Self::Node, key: impl AsRef<str>, ) -> Option<&NodeMetadata>
fn get_optype(&self, node: Self::Node) -> &OpType
fn num_nodes(&self) -> usize
fn num_edges(&self) -> usize
fn num_ports(&self, node: Self::Node, dir: Direction) -> usize
fn num_inputs(&self, node: Self::Node) -> usize
fn num_outputs(&self, node: Self::Node) -> usize
fn nodes(&self) -> impl Iterator<Item = Self::Node> + Clone
fn node_ports( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Port> + Clone
fn node_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = OutgoingPort> + Clone
fn node_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = IncomingPort> + Clone
fn all_node_ports(&self, node: Self::Node) -> impl Iterator<Item = Port> + Clone
fn linked_ports( &self, node: Self::Node, port: impl Into<Port>, ) -> impl Iterator<Item = (Self::Node, Port)> + Clone
fn all_linked_ports( &self, node: Self::Node, dir: Direction, ) -> Either<impl Iterator<Item = (Self::Node, OutgoingPort)>, impl Iterator<Item = (Self::Node, IncomingPort)>> ⓘ
fn all_linked_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>
fn all_linked_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>
fn single_linked_port( &self, node: Self::Node, port: impl Into<Port>, ) -> Option<(Self::Node, Port)>
fn single_linked_output( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> Option<(Self::Node, OutgoingPort)>
fn single_linked_input( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> Option<(Self::Node, IncomingPort)>
fn linked_outputs( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>
fn linked_inputs( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>
fn node_connections( &self, node: Self::Node, other: Self::Node, ) -> impl Iterator<Item = [Port; 2]> + Clone
fn is_linked(&self, node: Self::Node, port: impl Into<Port>) -> bool
fn children( &self, node: Self::Node, ) -> impl DoubleEndedIterator<Item = Self::Node> + Clone
fn descendants( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone
fn first_child(&self, node: Self::Node) -> Option<Self::Node>
fn neighbours( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Self::Node> + Clone
fn all_neighbours( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone
fn mermaid_string(&self) -> String
Source§fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String
fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String
mermaid_format
insteadfn mermaid_string_with_formatter( &self, formatter: MermaidFormatter<'_, Self>, ) -> String
fn dot_string(&self) -> String
fn static_source(&self, node: Self::Node) -> Option<Self::Node>
fn static_targets( &self, node: Self::Node, ) -> Option<impl Iterator<Item = (Self::Node, IncomingPort)>>
fn value_types( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = (Port, Type)>
fn extensions(&self) -> &ExtensionRegistry
fn validate(&self) -> Result<(), ValidationError<Self::Node>>
fn extract_hugr( &self, parent: Self::Node, ) -> (Hugr, impl ExtractionResult<Self::Node> + 'static)
Source§impl<T: HugrView> HugrView for &mut T
impl<T: HugrView> HugrView for &mut T
fn entrypoint(&self) -> Self::Node
fn entrypoint_optype(&self) -> &OpType
fn module_root(&self) -> Self::Node
fn contains_node(&self, node: Self::Node) -> bool
fn get_parent(&self, node: Self::Node) -> Option<Self::Node>
fn get_metadata( &self, node: Self::Node, key: impl AsRef<str>, ) -> Option<&NodeMetadata>
fn get_optype(&self, node: Self::Node) -> &OpType
fn num_nodes(&self) -> usize
fn num_edges(&self) -> usize
fn num_ports(&self, node: Self::Node, dir: Direction) -> usize
fn num_inputs(&self, node: Self::Node) -> usize
fn num_outputs(&self, node: Self::Node) -> usize
fn nodes(&self) -> impl Iterator<Item = Self::Node> + Clone
fn node_ports( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Port> + Clone
fn node_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = OutgoingPort> + Clone
fn node_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = IncomingPort> + Clone
fn all_node_ports(&self, node: Self::Node) -> impl Iterator<Item = Port> + Clone
fn linked_ports( &self, node: Self::Node, port: impl Into<Port>, ) -> impl Iterator<Item = (Self::Node, Port)> + Clone
fn all_linked_ports( &self, node: Self::Node, dir: Direction, ) -> Either<impl Iterator<Item = (Self::Node, OutgoingPort)>, impl Iterator<Item = (Self::Node, IncomingPort)>> ⓘ
fn all_linked_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>
fn all_linked_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>
fn single_linked_port( &self, node: Self::Node, port: impl Into<Port>, ) -> Option<(Self::Node, Port)>
fn single_linked_output( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> Option<(Self::Node, OutgoingPort)>
fn single_linked_input( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> Option<(Self::Node, IncomingPort)>
fn linked_outputs( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>
fn linked_inputs( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>
fn node_connections( &self, node: Self::Node, other: Self::Node, ) -> impl Iterator<Item = [Port; 2]> + Clone
fn is_linked(&self, node: Self::Node, port: impl Into<Port>) -> bool
fn children( &self, node: Self::Node, ) -> impl DoubleEndedIterator<Item = Self::Node> + Clone
fn descendants( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone
fn first_child(&self, node: Self::Node) -> Option<Self::Node>
fn neighbours( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Self::Node> + Clone
fn all_neighbours( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone
fn mermaid_string(&self) -> String
Source§fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String
fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String
mermaid_format
insteadfn mermaid_string_with_formatter( &self, formatter: MermaidFormatter<'_, Self>, ) -> String
fn dot_string(&self) -> String
fn static_source(&self, node: Self::Node) -> Option<Self::Node>
fn static_targets( &self, node: Self::Node, ) -> Option<impl Iterator<Item = (Self::Node, IncomingPort)>>
fn value_types( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = (Port, Type)>
fn extensions(&self) -> &ExtensionRegistry
fn validate(&self) -> Result<(), ValidationError<Self::Node>>
fn extract_hugr( &self, parent: Self::Node, ) -> (Hugr, impl ExtractionResult<Self::Node> + 'static)
Source§impl<T: HugrView> HugrView for Box<T>
impl<T: HugrView> HugrView for Box<T>
fn entrypoint(&self) -> Self::Node
fn entrypoint_optype(&self) -> &OpType
fn module_root(&self) -> Self::Node
fn contains_node(&self, node: Self::Node) -> bool
fn get_parent(&self, node: Self::Node) -> Option<Self::Node>
fn get_metadata( &self, node: Self::Node, key: impl AsRef<str>, ) -> Option<&NodeMetadata>
fn get_optype(&self, node: Self::Node) -> &OpType
fn num_nodes(&self) -> usize
fn num_edges(&self) -> usize
fn num_ports(&self, node: Self::Node, dir: Direction) -> usize
fn num_inputs(&self, node: Self::Node) -> usize
fn num_outputs(&self, node: Self::Node) -> usize
fn nodes(&self) -> impl Iterator<Item = Self::Node> + Clone
fn node_ports( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Port> + Clone
fn node_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = OutgoingPort> + Clone
fn node_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = IncomingPort> + Clone
fn all_node_ports(&self, node: Self::Node) -> impl Iterator<Item = Port> + Clone
fn linked_ports( &self, node: Self::Node, port: impl Into<Port>, ) -> impl Iterator<Item = (Self::Node, Port)> + Clone
fn all_linked_ports( &self, node: Self::Node, dir: Direction, ) -> Either<impl Iterator<Item = (Self::Node, OutgoingPort)>, impl Iterator<Item = (Self::Node, IncomingPort)>> ⓘ
fn all_linked_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>
fn all_linked_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>
fn single_linked_port( &self, node: Self::Node, port: impl Into<Port>, ) -> Option<(Self::Node, Port)>
fn single_linked_output( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> Option<(Self::Node, OutgoingPort)>
fn single_linked_input( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> Option<(Self::Node, IncomingPort)>
fn linked_outputs( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>
fn linked_inputs( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>
fn node_connections( &self, node: Self::Node, other: Self::Node, ) -> impl Iterator<Item = [Port; 2]> + Clone
fn is_linked(&self, node: Self::Node, port: impl Into<Port>) -> bool
fn children( &self, node: Self::Node, ) -> impl DoubleEndedIterator<Item = Self::Node> + Clone
fn descendants( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone
fn first_child(&self, node: Self::Node) -> Option<Self::Node>
fn neighbours( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Self::Node> + Clone
fn all_neighbours( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone
fn mermaid_string(&self) -> String
Source§fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String
fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String
mermaid_format
insteadfn mermaid_string_with_formatter( &self, formatter: MermaidFormatter<'_, Self>, ) -> String
fn dot_string(&self) -> String
fn static_source(&self, node: Self::Node) -> Option<Self::Node>
fn static_targets( &self, node: Self::Node, ) -> Option<impl Iterator<Item = (Self::Node, IncomingPort)>>
fn value_types( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = (Port, Type)>
fn extensions(&self) -> &ExtensionRegistry
fn validate(&self) -> Result<(), ValidationError<Self::Node>>
fn extract_hugr( &self, parent: Self::Node, ) -> (Hugr, impl ExtractionResult<Self::Node> + 'static)
Source§impl<T: HugrView> HugrView for Rc<T>
impl<T: HugrView> HugrView for Rc<T>
fn entrypoint(&self) -> Self::Node
fn entrypoint_optype(&self) -> &OpType
fn module_root(&self) -> Self::Node
fn contains_node(&self, node: Self::Node) -> bool
fn get_parent(&self, node: Self::Node) -> Option<Self::Node>
fn get_metadata( &self, node: Self::Node, key: impl AsRef<str>, ) -> Option<&NodeMetadata>
fn get_optype(&self, node: Self::Node) -> &OpType
fn num_nodes(&self) -> usize
fn num_edges(&self) -> usize
fn num_ports(&self, node: Self::Node, dir: Direction) -> usize
fn num_inputs(&self, node: Self::Node) -> usize
fn num_outputs(&self, node: Self::Node) -> usize
fn nodes(&self) -> impl Iterator<Item = Self::Node> + Clone
fn node_ports( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Port> + Clone
fn node_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = OutgoingPort> + Clone
fn node_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = IncomingPort> + Clone
fn all_node_ports(&self, node: Self::Node) -> impl Iterator<Item = Port> + Clone
fn linked_ports( &self, node: Self::Node, port: impl Into<Port>, ) -> impl Iterator<Item = (Self::Node, Port)> + Clone
fn all_linked_ports( &self, node: Self::Node, dir: Direction, ) -> Either<impl Iterator<Item = (Self::Node, OutgoingPort)>, impl Iterator<Item = (Self::Node, IncomingPort)>> ⓘ
fn all_linked_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>
fn all_linked_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>
fn single_linked_port( &self, node: Self::Node, port: impl Into<Port>, ) -> Option<(Self::Node, Port)>
fn single_linked_output( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> Option<(Self::Node, OutgoingPort)>
fn single_linked_input( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> Option<(Self::Node, IncomingPort)>
fn linked_outputs( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>
fn linked_inputs( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>
fn node_connections( &self, node: Self::Node, other: Self::Node, ) -> impl Iterator<Item = [Port; 2]> + Clone
fn is_linked(&self, node: Self::Node, port: impl Into<Port>) -> bool
fn children( &self, node: Self::Node, ) -> impl DoubleEndedIterator<Item = Self::Node> + Clone
fn descendants( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone
fn first_child(&self, node: Self::Node) -> Option<Self::Node>
fn neighbours( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Self::Node> + Clone
fn all_neighbours( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone
fn mermaid_string(&self) -> String
Source§fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String
fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String
mermaid_format
insteadfn mermaid_string_with_formatter( &self, formatter: MermaidFormatter<'_, Self>, ) -> String
fn dot_string(&self) -> String
fn static_source(&self, node: Self::Node) -> Option<Self::Node>
fn static_targets( &self, node: Self::Node, ) -> Option<impl Iterator<Item = (Self::Node, IncomingPort)>>
fn value_types( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = (Port, Type)>
fn extensions(&self) -> &ExtensionRegistry
fn validate(&self) -> Result<(), ValidationError<Self::Node>>
fn extract_hugr( &self, parent: Self::Node, ) -> (Hugr, impl ExtractionResult<Self::Node> + 'static)
Source§impl<T: HugrView> HugrView for Arc<T>
impl<T: HugrView> HugrView for Arc<T>
fn entrypoint(&self) -> Self::Node
fn entrypoint_optype(&self) -> &OpType
fn module_root(&self) -> Self::Node
fn contains_node(&self, node: Self::Node) -> bool
fn get_parent(&self, node: Self::Node) -> Option<Self::Node>
fn get_metadata( &self, node: Self::Node, key: impl AsRef<str>, ) -> Option<&NodeMetadata>
fn get_optype(&self, node: Self::Node) -> &OpType
fn num_nodes(&self) -> usize
fn num_edges(&self) -> usize
fn num_ports(&self, node: Self::Node, dir: Direction) -> usize
fn num_inputs(&self, node: Self::Node) -> usize
fn num_outputs(&self, node: Self::Node) -> usize
fn nodes(&self) -> impl Iterator<Item = Self::Node> + Clone
fn node_ports( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Port> + Clone
fn node_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = OutgoingPort> + Clone
fn node_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = IncomingPort> + Clone
fn all_node_ports(&self, node: Self::Node) -> impl Iterator<Item = Port> + Clone
fn linked_ports( &self, node: Self::Node, port: impl Into<Port>, ) -> impl Iterator<Item = (Self::Node, Port)> + Clone
fn all_linked_ports( &self, node: Self::Node, dir: Direction, ) -> Either<impl Iterator<Item = (Self::Node, OutgoingPort)>, impl Iterator<Item = (Self::Node, IncomingPort)>> ⓘ
fn all_linked_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>
fn all_linked_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>
fn single_linked_port( &self, node: Self::Node, port: impl Into<Port>, ) -> Option<(Self::Node, Port)>
fn single_linked_output( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> Option<(Self::Node, OutgoingPort)>
fn single_linked_input( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> Option<(Self::Node, IncomingPort)>
fn linked_outputs( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>
fn linked_inputs( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>
fn node_connections( &self, node: Self::Node, other: Self::Node, ) -> impl Iterator<Item = [Port; 2]> + Clone
fn is_linked(&self, node: Self::Node, port: impl Into<Port>) -> bool
fn children( &self, node: Self::Node, ) -> impl DoubleEndedIterator<Item = Self::Node> + Clone
fn descendants( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone
fn first_child(&self, node: Self::Node) -> Option<Self::Node>
fn neighbours( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Self::Node> + Clone
fn all_neighbours( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone
fn mermaid_string(&self) -> String
Source§fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String
fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String
mermaid_format
instead