Trait HugrView

Source
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§

Source

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.

Source

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.

Source

fn contains_node(&self, node: Self::Node) -> bool

Returns true if the node exists in the HUGR.

Source

fn get_parent(&self, node: Self::Node) -> Option<Self::Node>

Returns the parent of a node.

Source

fn get_optype(&self, node: Self::Node) -> &OpType

Returns the operation type of a node.

§Panics

If the node is not in the graph.

Source

fn num_nodes(&self) -> usize

Returns the number of nodes in the HUGR.

Source

fn num_edges(&self) -> usize

Returns the number of edges in the HUGR.

Source

fn num_ports(&self, node: Self::Node, dir: Direction) -> usize

Number of ports in node for a given direction.

Source

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.

Source

fn node_ports( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Port> + Clone

Iterator over ports of node in a given direction.

Source

fn all_node_ports(&self, node: Self::Node) -> impl Iterator<Item = Port> + Clone

Iterator over both the input and output ports of node.

Source

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.

Source

fn node_connections( &self, node: Self::Node, other: Self::Node, ) -> impl Iterator<Item = [Port; 2]> + Clone

Iterator the links between two nodes.

Source

fn children( &self, node: Self::Node, ) -> impl DoubleEndedIterator<Item = Self::Node> + Clone

Returns an iterator over the direct children of node.

Source

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.

Source

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.

Source

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.

Source

fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String

👎Deprecated: Use mermaid_format instead

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.

Source

fn dot_string(&self) -> String
where 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.

Source

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.

Source

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§

Source

fn entrypoint_optype(&self) -> &OpType

Returns the operation type of the entrypoint node.

Source

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.

Source

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.

Source

fn get_metadata( &self, node: Self::Node, key: impl AsRef<str>, ) -> Option<&NodeMetadata>

Returns the metadata associated with a node.

Source

fn num_inputs(&self, node: Self::Node) -> usize

Number of inputs to a node. Shorthand for num_ports(node, Direction::Incoming).

Source

fn num_outputs(&self, node: Self::Node) -> usize

Number of outputs from a node. Shorthand for num_ports(node, Direction::Outgoing).

Source

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 OutgoingPorts.

Source

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 IncomingPorts.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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 OutgoingPorts.

Source

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 IncomingPorts.

Source

fn is_linked(&self, node: Self::Node, port: impl Into<Port>) -> bool

Returns whether a port is connected.

Source

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.

Source

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.

Source

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

Source

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

Source

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

Source

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.

Source

fn poly_func_type(&self) -> Option<PolyFuncType>

Returns the function type defined by this HUGR, i.e. Some iff the root is a FuncDecl or FuncDefn.

Source

fn as_petgraph(&self) -> PetgraphWrapper<'_, Self>
where Self: Sized,

Return a wrapper over the view that can be used in petgraph algorithms.

Source

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.

Source

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.

Source

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.

Source

fn static_source(&self, node: Self::Node) -> Option<Self::Node>

If a node has a static input, return the source node.

Source

fn static_targets( &self, node: Self::Node, ) -> Option<impl Iterator<Item = (Self::Node, IncomingPort)>>

If a node has a static output, return the targets.

Source

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.

Source

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.

Source

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.

Source

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.

Source

fn validate(&self) -> Result<(), ValidationError<Self::Node>>
where Self: Sized,

Check the validity of the underlying HUGR.

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>

Source§

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

Source§

fn entrypoint_optype(&self) -> &OpType

Source§

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

Source§

fn contains_node(&self, node: Self::Node) -> bool

Source§

fn get_parent(&self, node: Self::Node) -> Option<Self::Node>

Source§

fn get_metadata( &self, node: Self::Node, key: impl AsRef<str>, ) -> Option<&NodeMetadata>

Source§

fn get_optype(&self, node: Self::Node) -> &OpType

Source§

fn num_nodes(&self) -> usize

Source§

fn num_edges(&self) -> usize

Source§

fn num_ports(&self, node: Self::Node, dir: Direction) -> usize

Source§

fn num_inputs(&self, node: Self::Node) -> usize

Source§

fn num_outputs(&self, node: Self::Node) -> usize

Source§

fn nodes(&self) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn node_ports( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Port> + Clone

Source§

fn node_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = OutgoingPort> + Clone

Source§

fn node_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = IncomingPort> + Clone

Source§

fn all_node_ports(&self, node: Self::Node) -> impl Iterator<Item = Port> + Clone

Source§

fn linked_ports( &self, node: Self::Node, port: impl Into<Port>, ) -> impl Iterator<Item = (Self::Node, Port)> + Clone

Source§

fn all_linked_ports( &self, node: Self::Node, dir: Direction, ) -> Either<impl Iterator<Item = (Self::Node, OutgoingPort)>, impl Iterator<Item = (Self::Node, IncomingPort)>>

Source§

fn all_linked_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>

Source§

fn all_linked_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>

Source§

fn single_linked_port( &self, node: Self::Node, port: impl Into<Port>, ) -> Option<(Self::Node, Port)>

Source§

fn single_linked_output( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> Option<(Self::Node, OutgoingPort)>

Source§

fn single_linked_input( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> Option<(Self::Node, IncomingPort)>

Source§

fn linked_outputs( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>

Source§

fn linked_inputs( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>

Source§

fn node_connections( &self, node: Self::Node, other: Self::Node, ) -> impl Iterator<Item = [Port; 2]> + Clone

Source§

fn is_linked(&self, node: Self::Node, port: impl Into<Port>) -> bool

Source§

fn children( &self, node: Self::Node, ) -> impl DoubleEndedIterator<Item = Self::Node> + Clone

Source§

fn descendants( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn first_child(&self, node: Self::Node) -> Option<Self::Node>

Source§

fn neighbours( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn all_neighbours( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn mermaid_string(&self) -> String

Source§

fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String

👎Deprecated: Use mermaid_format instead
Source§

fn mermaid_string_with_formatter( &self, formatter: MermaidFormatter<'_, Self>, ) -> String

Source§

fn dot_string(&self) -> String

Source§

fn static_source(&self, node: Self::Node) -> Option<Self::Node>

Source§

fn static_targets( &self, node: Self::Node, ) -> Option<impl Iterator<Item = (Self::Node, IncomingPort)>>

Source§

fn value_types( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = (Port, Type)>

Source§

fn extensions(&self) -> &ExtensionRegistry

Source§

fn validate(&self) -> Result<(), ValidationError<Self::Node>>

Source§

fn extract_hugr( &self, parent: Self::Node, ) -> (Hugr, impl ExtractionResult<Self::Node> + 'static)

Source§

impl<T: HugrView> HugrView for &T

Source§

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

Source§

fn entrypoint_optype(&self) -> &OpType

Source§

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

Source§

fn contains_node(&self, node: Self::Node) -> bool

Source§

fn get_parent(&self, node: Self::Node) -> Option<Self::Node>

Source§

fn get_metadata( &self, node: Self::Node, key: impl AsRef<str>, ) -> Option<&NodeMetadata>

Source§

fn get_optype(&self, node: Self::Node) -> &OpType

Source§

fn num_nodes(&self) -> usize

Source§

fn num_edges(&self) -> usize

Source§

fn num_ports(&self, node: Self::Node, dir: Direction) -> usize

Source§

fn num_inputs(&self, node: Self::Node) -> usize

Source§

fn num_outputs(&self, node: Self::Node) -> usize

Source§

fn nodes(&self) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn node_ports( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Port> + Clone

Source§

fn node_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = OutgoingPort> + Clone

Source§

fn node_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = IncomingPort> + Clone

Source§

fn all_node_ports(&self, node: Self::Node) -> impl Iterator<Item = Port> + Clone

Source§

fn linked_ports( &self, node: Self::Node, port: impl Into<Port>, ) -> impl Iterator<Item = (Self::Node, Port)> + Clone

Source§

fn all_linked_ports( &self, node: Self::Node, dir: Direction, ) -> Either<impl Iterator<Item = (Self::Node, OutgoingPort)>, impl Iterator<Item = (Self::Node, IncomingPort)>>

Source§

fn all_linked_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>

Source§

fn all_linked_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>

Source§

fn single_linked_port( &self, node: Self::Node, port: impl Into<Port>, ) -> Option<(Self::Node, Port)>

Source§

fn single_linked_output( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> Option<(Self::Node, OutgoingPort)>

Source§

fn single_linked_input( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> Option<(Self::Node, IncomingPort)>

Source§

fn linked_outputs( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>

Source§

fn linked_inputs( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>

Source§

fn node_connections( &self, node: Self::Node, other: Self::Node, ) -> impl Iterator<Item = [Port; 2]> + Clone

Source§

fn is_linked(&self, node: Self::Node, port: impl Into<Port>) -> bool

Source§

fn children( &self, node: Self::Node, ) -> impl DoubleEndedIterator<Item = Self::Node> + Clone

Source§

fn descendants( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn first_child(&self, node: Self::Node) -> Option<Self::Node>

Source§

fn neighbours( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn all_neighbours( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn mermaid_string(&self) -> String

Source§

fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String

👎Deprecated: Use mermaid_format instead
Source§

fn mermaid_string_with_formatter( &self, formatter: MermaidFormatter<'_, Self>, ) -> String

Source§

fn dot_string(&self) -> String

Source§

fn static_source(&self, node: Self::Node) -> Option<Self::Node>

Source§

fn static_targets( &self, node: Self::Node, ) -> Option<impl Iterator<Item = (Self::Node, IncomingPort)>>

Source§

fn value_types( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = (Port, Type)>

Source§

fn extensions(&self) -> &ExtensionRegistry

Source§

fn validate(&self) -> Result<(), ValidationError<Self::Node>>

Source§

fn extract_hugr( &self, parent: Self::Node, ) -> (Hugr, impl ExtractionResult<Self::Node> + 'static)

Source§

impl<T: HugrView> HugrView for &mut T

Source§

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

Source§

fn entrypoint_optype(&self) -> &OpType

Source§

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

Source§

fn contains_node(&self, node: Self::Node) -> bool

Source§

fn get_parent(&self, node: Self::Node) -> Option<Self::Node>

Source§

fn get_metadata( &self, node: Self::Node, key: impl AsRef<str>, ) -> Option<&NodeMetadata>

Source§

fn get_optype(&self, node: Self::Node) -> &OpType

Source§

fn num_nodes(&self) -> usize

Source§

fn num_edges(&self) -> usize

Source§

fn num_ports(&self, node: Self::Node, dir: Direction) -> usize

Source§

fn num_inputs(&self, node: Self::Node) -> usize

Source§

fn num_outputs(&self, node: Self::Node) -> usize

Source§

fn nodes(&self) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn node_ports( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Port> + Clone

Source§

fn node_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = OutgoingPort> + Clone

Source§

fn node_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = IncomingPort> + Clone

Source§

fn all_node_ports(&self, node: Self::Node) -> impl Iterator<Item = Port> + Clone

Source§

fn linked_ports( &self, node: Self::Node, port: impl Into<Port>, ) -> impl Iterator<Item = (Self::Node, Port)> + Clone

Source§

fn all_linked_ports( &self, node: Self::Node, dir: Direction, ) -> Either<impl Iterator<Item = (Self::Node, OutgoingPort)>, impl Iterator<Item = (Self::Node, IncomingPort)>>

Source§

fn all_linked_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>

Source§

fn all_linked_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>

Source§

fn single_linked_port( &self, node: Self::Node, port: impl Into<Port>, ) -> Option<(Self::Node, Port)>

Source§

fn single_linked_output( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> Option<(Self::Node, OutgoingPort)>

Source§

fn single_linked_input( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> Option<(Self::Node, IncomingPort)>

Source§

fn linked_outputs( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>

Source§

fn linked_inputs( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>

Source§

fn node_connections( &self, node: Self::Node, other: Self::Node, ) -> impl Iterator<Item = [Port; 2]> + Clone

Source§

fn is_linked(&self, node: Self::Node, port: impl Into<Port>) -> bool

Source§

fn children( &self, node: Self::Node, ) -> impl DoubleEndedIterator<Item = Self::Node> + Clone

Source§

fn descendants( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn first_child(&self, node: Self::Node) -> Option<Self::Node>

Source§

fn neighbours( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn all_neighbours( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn mermaid_string(&self) -> String

Source§

fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String

👎Deprecated: Use mermaid_format instead
Source§

fn mermaid_string_with_formatter( &self, formatter: MermaidFormatter<'_, Self>, ) -> String

Source§

fn dot_string(&self) -> String

Source§

fn static_source(&self, node: Self::Node) -> Option<Self::Node>

Source§

fn static_targets( &self, node: Self::Node, ) -> Option<impl Iterator<Item = (Self::Node, IncomingPort)>>

Source§

fn value_types( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = (Port, Type)>

Source§

fn extensions(&self) -> &ExtensionRegistry

Source§

fn validate(&self) -> Result<(), ValidationError<Self::Node>>

Source§

fn extract_hugr( &self, parent: Self::Node, ) -> (Hugr, impl ExtractionResult<Self::Node> + 'static)

Source§

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

Source§

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

Source§

fn entrypoint_optype(&self) -> &OpType

Source§

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

Source§

fn contains_node(&self, node: Self::Node) -> bool

Source§

fn get_parent(&self, node: Self::Node) -> Option<Self::Node>

Source§

fn get_metadata( &self, node: Self::Node, key: impl AsRef<str>, ) -> Option<&NodeMetadata>

Source§

fn get_optype(&self, node: Self::Node) -> &OpType

Source§

fn num_nodes(&self) -> usize

Source§

fn num_edges(&self) -> usize

Source§

fn num_ports(&self, node: Self::Node, dir: Direction) -> usize

Source§

fn num_inputs(&self, node: Self::Node) -> usize

Source§

fn num_outputs(&self, node: Self::Node) -> usize

Source§

fn nodes(&self) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn node_ports( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Port> + Clone

Source§

fn node_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = OutgoingPort> + Clone

Source§

fn node_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = IncomingPort> + Clone

Source§

fn all_node_ports(&self, node: Self::Node) -> impl Iterator<Item = Port> + Clone

Source§

fn linked_ports( &self, node: Self::Node, port: impl Into<Port>, ) -> impl Iterator<Item = (Self::Node, Port)> + Clone

Source§

fn all_linked_ports( &self, node: Self::Node, dir: Direction, ) -> Either<impl Iterator<Item = (Self::Node, OutgoingPort)>, impl Iterator<Item = (Self::Node, IncomingPort)>>

Source§

fn all_linked_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>

Source§

fn all_linked_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>

Source§

fn single_linked_port( &self, node: Self::Node, port: impl Into<Port>, ) -> Option<(Self::Node, Port)>

Source§

fn single_linked_output( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> Option<(Self::Node, OutgoingPort)>

Source§

fn single_linked_input( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> Option<(Self::Node, IncomingPort)>

Source§

fn linked_outputs( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>

Source§

fn linked_inputs( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>

Source§

fn node_connections( &self, node: Self::Node, other: Self::Node, ) -> impl Iterator<Item = [Port; 2]> + Clone

Source§

fn is_linked(&self, node: Self::Node, port: impl Into<Port>) -> bool

Source§

fn children( &self, node: Self::Node, ) -> impl DoubleEndedIterator<Item = Self::Node> + Clone

Source§

fn descendants( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn first_child(&self, node: Self::Node) -> Option<Self::Node>

Source§

fn neighbours( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn all_neighbours( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn mermaid_string(&self) -> String

Source§

fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String

👎Deprecated: Use mermaid_format instead
Source§

fn mermaid_string_with_formatter( &self, formatter: MermaidFormatter<'_, Self>, ) -> String

Source§

fn dot_string(&self) -> String

Source§

fn static_source(&self, node: Self::Node) -> Option<Self::Node>

Source§

fn static_targets( &self, node: Self::Node, ) -> Option<impl Iterator<Item = (Self::Node, IncomingPort)>>

Source§

fn value_types( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = (Port, Type)>

Source§

fn extensions(&self) -> &ExtensionRegistry

Source§

fn validate(&self) -> Result<(), ValidationError<Self::Node>>

Source§

fn extract_hugr( &self, parent: Self::Node, ) -> (Hugr, impl ExtractionResult<Self::Node> + 'static)

Source§

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

Source§

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

Source§

fn entrypoint_optype(&self) -> &OpType

Source§

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

Source§

fn contains_node(&self, node: Self::Node) -> bool

Source§

fn get_parent(&self, node: Self::Node) -> Option<Self::Node>

Source§

fn get_metadata( &self, node: Self::Node, key: impl AsRef<str>, ) -> Option<&NodeMetadata>

Source§

fn get_optype(&self, node: Self::Node) -> &OpType

Source§

fn num_nodes(&self) -> usize

Source§

fn num_edges(&self) -> usize

Source§

fn num_ports(&self, node: Self::Node, dir: Direction) -> usize

Source§

fn num_inputs(&self, node: Self::Node) -> usize

Source§

fn num_outputs(&self, node: Self::Node) -> usize

Source§

fn nodes(&self) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn node_ports( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Port> + Clone

Source§

fn node_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = OutgoingPort> + Clone

Source§

fn node_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = IncomingPort> + Clone

Source§

fn all_node_ports(&self, node: Self::Node) -> impl Iterator<Item = Port> + Clone

Source§

fn linked_ports( &self, node: Self::Node, port: impl Into<Port>, ) -> impl Iterator<Item = (Self::Node, Port)> + Clone

Source§

fn all_linked_ports( &self, node: Self::Node, dir: Direction, ) -> Either<impl Iterator<Item = (Self::Node, OutgoingPort)>, impl Iterator<Item = (Self::Node, IncomingPort)>>

Source§

fn all_linked_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>

Source§

fn all_linked_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>

Source§

fn single_linked_port( &self, node: Self::Node, port: impl Into<Port>, ) -> Option<(Self::Node, Port)>

Source§

fn single_linked_output( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> Option<(Self::Node, OutgoingPort)>

Source§

fn single_linked_input( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> Option<(Self::Node, IncomingPort)>

Source§

fn linked_outputs( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>

Source§

fn linked_inputs( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>

Source§

fn node_connections( &self, node: Self::Node, other: Self::Node, ) -> impl Iterator<Item = [Port; 2]> + Clone

Source§

fn is_linked(&self, node: Self::Node, port: impl Into<Port>) -> bool

Source§

fn children( &self, node: Self::Node, ) -> impl DoubleEndedIterator<Item = Self::Node> + Clone

Source§

fn descendants( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn first_child(&self, node: Self::Node) -> Option<Self::Node>

Source§

fn neighbours( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn all_neighbours( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn mermaid_string(&self) -> String

Source§

fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String

👎Deprecated: Use mermaid_format instead
Source§

fn mermaid_string_with_formatter( &self, formatter: MermaidFormatter<'_, Self>, ) -> String

Source§

fn dot_string(&self) -> String

Source§

fn static_source(&self, node: Self::Node) -> Option<Self::Node>

Source§

fn static_targets( &self, node: Self::Node, ) -> Option<impl Iterator<Item = (Self::Node, IncomingPort)>>

Source§

fn value_types( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = (Port, Type)>

Source§

fn extensions(&self) -> &ExtensionRegistry

Source§

fn validate(&self) -> Result<(), ValidationError<Self::Node>>

Source§

fn extract_hugr( &self, parent: Self::Node, ) -> (Hugr, impl ExtractionResult<Self::Node> + 'static)

Source§

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

Source§

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

Source§

fn entrypoint_optype(&self) -> &OpType

Source§

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

Source§

fn contains_node(&self, node: Self::Node) -> bool

Source§

fn get_parent(&self, node: Self::Node) -> Option<Self::Node>

Source§

fn get_metadata( &self, node: Self::Node, key: impl AsRef<str>, ) -> Option<&NodeMetadata>

Source§

fn get_optype(&self, node: Self::Node) -> &OpType

Source§

fn num_nodes(&self) -> usize

Source§

fn num_edges(&self) -> usize

Source§

fn num_ports(&self, node: Self::Node, dir: Direction) -> usize

Source§

fn num_inputs(&self, node: Self::Node) -> usize

Source§

fn num_outputs(&self, node: Self::Node) -> usize

Source§

fn nodes(&self) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn node_ports( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Port> + Clone

Source§

fn node_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = OutgoingPort> + Clone

Source§

fn node_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = IncomingPort> + Clone

Source§

fn all_node_ports(&self, node: Self::Node) -> impl Iterator<Item = Port> + Clone

Source§

fn linked_ports( &self, node: Self::Node, port: impl Into<Port>, ) -> impl Iterator<Item = (Self::Node, Port)> + Clone

Source§

fn all_linked_ports( &self, node: Self::Node, dir: Direction, ) -> Either<impl Iterator<Item = (Self::Node, OutgoingPort)>, impl Iterator<Item = (Self::Node, IncomingPort)>>

Source§

fn all_linked_outputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>

Source§

fn all_linked_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>

Source§

fn single_linked_port( &self, node: Self::Node, port: impl Into<Port>, ) -> Option<(Self::Node, Port)>

Source§

fn single_linked_output( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> Option<(Self::Node, OutgoingPort)>

Source§

fn single_linked_input( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> Option<(Self::Node, IncomingPort)>

Source§

fn linked_outputs( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>

Source§

fn linked_inputs( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>

Source§

fn node_connections( &self, node: Self::Node, other: Self::Node, ) -> impl Iterator<Item = [Port; 2]> + Clone

Source§

fn is_linked(&self, node: Self::Node, port: impl Into<Port>) -> bool

Source§

fn children( &self, node: Self::Node, ) -> impl DoubleEndedIterator<Item = Self::Node> + Clone

Source§

fn descendants( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn first_child(&self, node: Self::Node) -> Option<Self::Node>

Source§

fn neighbours( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn all_neighbours( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Node> + Clone

Source§

fn mermaid_string(&self) -> String

Source§

fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String

👎Deprecated: Use mermaid_format instead
Source§

fn mermaid_string_with_formatter( &self, formatter: MermaidFormatter<'_, Self>, ) -> String

Source§

fn dot_string(&self) -> String

Source§

fn static_source(&self, node: Self::Node) -> Option<Self::Node>

Source§

fn static_targets( &self, node: Self::Node, ) -> Option<impl Iterator<Item = (Self::Node, IncomingPort)>>

Source§

fn value_types( &self, node: Self::Node, dir: Direction, ) -> impl Iterator<Item = (Port, Type)>

Source§

fn extensions(&self) -> &ExtensionRegistry

Source§

fn validate(&self) -> Result<(), ValidationError<Self::Node>>

Source§

fn extract_hugr( &self, parent: Self::Node, ) -> (Hugr, impl ExtractionResult<Self::Node> + 'static)

Implementors§