pub struct Rerooted<H: HugrView> { /* private fields */ }
Expand description
A HUGR wrapper with a modified entrypoint node.
All nodes from the original are still present, but the main entrypoint used for traversals and optimizations is altered.
Implementations§
Trait Implementations§
Source§impl<H: HugrView> HugrInternals for Rerooted<H>
impl<H: HugrView> HugrInternals for Rerooted<H>
Source§type RegionPortgraph<'p> = <H as HugrInternals>::RegionPortgraph<'p>
where
Self: 'p
type RegionPortgraph<'p> = <H as HugrInternals>::RegionPortgraph<'p> where Self: 'p
The portgraph graph structure returned by
HugrInternals::region_portgraph
.Source§type Node = <H as HugrInternals>::Node
type Node = <H as HugrInternals>::Node
The type of nodes in the Hugr.
Source§type RegionPortgraphNodes = <H as HugrInternals>::RegionPortgraphNodes
type RegionPortgraphNodes = <H as HugrInternals>::RegionPortgraphNodes
A mapping between HUGR nodes and portgraph nodes in the graph returned by
HugrInternals::region_portgraph
.Source§fn region_portgraph(
&self,
parent: Self::Node,
) -> (FlatRegion<'_, Self::RegionPortgraph<'_>>, Self::RegionPortgraphNodes)
fn region_portgraph( &self, parent: Self::Node, ) -> (FlatRegion<'_, Self::RegionPortgraph<'_>>, Self::RegionPortgraphNodes)
Returns a flat portgraph view of a region in the HUGR, and a mapping between
HUGR nodes and portgraph nodes in the graph.
Source§fn node_metadata_map(&self, node: Self::Node) -> &NodeMetadataMap
fn node_metadata_map(&self, node: Self::Node) -> &NodeMetadataMap
Returns a metadata entry associated with a node. Read more
Source§impl<H: HugrMut> HugrMut for Rerooted<H>
impl<H: HugrMut> HugrMut for Rerooted<H>
Source§fn set_entrypoint(&mut self, root: Self::Node)
fn set_entrypoint(&mut self, root: Self::Node)
Set entrypoint to the HUGR. Read more
Source§fn get_metadata_mut(
&mut self,
node: Self::Node,
key: impl AsRef<str>,
) -> &mut NodeMetadata
fn get_metadata_mut( &mut self, node: Self::Node, key: impl AsRef<str>, ) -> &mut NodeMetadata
Returns a metadata entry associated with a node. Read more
Source§fn set_metadata(
&mut self,
node: Self::Node,
key: impl AsRef<str>,
metadata: impl Into<NodeMetadata>,
)
fn set_metadata( &mut self, node: Self::Node, key: impl AsRef<str>, metadata: impl Into<NodeMetadata>, )
Sets a metadata value associated with a node. Read more
Source§fn remove_metadata(&mut self, node: Self::Node, key: impl AsRef<str>)
fn remove_metadata(&mut self, node: Self::Node, key: impl AsRef<str>)
Remove a metadata entry associated with a node. Read more
Source§fn add_node_with_parent(
&mut self,
parent: Self::Node,
op: impl Into<OpType>,
) -> Self::Node
fn add_node_with_parent( &mut self, parent: Self::Node, op: impl Into<OpType>, ) -> Self::Node
Add a node to the graph with a parent in the hierarchy. Read more
Source§fn add_node_before(
&mut self,
sibling: Self::Node,
nodetype: impl Into<OpType>,
) -> Self::Node
fn add_node_before( &mut self, sibling: Self::Node, nodetype: impl Into<OpType>, ) -> Self::Node
Add a node to the graph as the previous sibling of another node. Read more
Source§fn add_node_after(
&mut self,
sibling: Self::Node,
op: impl Into<OpType>,
) -> Self::Node
fn add_node_after( &mut self, sibling: Self::Node, op: impl Into<OpType>, ) -> Self::Node
Add a node to the graph as the next sibling of another node. Read more
Source§fn remove_node(&mut self, node: Self::Node) -> OpType
fn remove_node(&mut self, node: Self::Node) -> OpType
Remove a node from the graph and return the node weight.
Note that if the node has children, they are not removed; this leaves
the Hugr in an invalid state. See
Self::remove_subtree
. Read moreSource§fn remove_subtree(&mut self, node: Self::Node)
fn remove_subtree(&mut self, node: Self::Node)
Remove a node from the graph, along with all its descendants in the hierarchy. Read more
Source§fn copy_descendants(
&mut self,
root: Self::Node,
new_parent: Self::Node,
subst: Option<Substitution<'_>>,
) -> BTreeMap<Self::Node, Self::Node>
fn copy_descendants( &mut self, root: Self::Node, new_parent: Self::Node, subst: Option<Substitution<'_>>, ) -> BTreeMap<Self::Node, Self::Node>
Copies the strict descendants of
root
to under the new_parent
, optionally applying a
Substitution to the OpType
s of the copied nodes. Read moreSource§fn connect(
&mut self,
src: Self::Node,
src_port: impl Into<OutgoingPort>,
dst: Self::Node,
dst_port: impl Into<IncomingPort>,
)
fn connect( &mut self, src: Self::Node, src_port: impl Into<OutgoingPort>, dst: Self::Node, dst_port: impl Into<IncomingPort>, )
Connect two nodes at the given ports. Read more
Source§fn disconnect(&mut self, node: Self::Node, port: impl Into<Port>)
fn disconnect(&mut self, node: Self::Node, port: impl Into<Port>)
Disconnects all edges from the given port. Read more
Source§fn add_other_edge(
&mut self,
src: Self::Node,
dst: Self::Node,
) -> (OutgoingPort, IncomingPort)
fn add_other_edge( &mut self, src: Self::Node, dst: Self::Node, ) -> (OutgoingPort, IncomingPort)
Adds a non-dataflow edge between two nodes. The kind is given by the
operation’s
OpTrait::other_input
or OpTrait::other_output
. Read moreSource§fn insert_hugr(
&mut self,
root: Self::Node,
other: Hugr,
) -> InsertionResult<Node, Self::Node>
fn insert_hugr( &mut self, root: Self::Node, other: Hugr, ) -> InsertionResult<Node, Self::Node>
Insert another hugr into this one, under a given parent node. Read more
Source§fn insert_region(
&mut self,
root: Self::Node,
other: Hugr,
region: Node,
) -> InsertionResult<Node, Self::Node>
fn insert_region( &mut self, root: Self::Node, other: Hugr, region: Node, ) -> InsertionResult<Node, Self::Node>
Insert a sub-region of another hugr into this one, under a given parent node. Read more
Source§fn insert_from_view<Other: HugrView>(
&mut self,
root: Self::Node,
other: &Other,
) -> InsertionResult<Other::Node, Self::Node>
fn insert_from_view<Other: HugrView>( &mut self, root: Self::Node, other: &Other, ) -> InsertionResult<Other::Node, Self::Node>
Copy another hugr into this one, under a given parent node. Read more
Source§fn insert_subgraph<Other: HugrView>(
&mut self,
root: Self::Node,
other: &Other,
subgraph: &SiblingSubgraph<Other::Node>,
) -> HashMap<Other::Node, Self::Node>
fn insert_subgraph<Other: HugrView>( &mut self, root: Self::Node, other: &Other, subgraph: &SiblingSubgraph<Other::Node>, ) -> HashMap<Other::Node, Self::Node>
Copy a subgraph from another hugr into this one, under a given parent node. Read more
Source§fn use_extension(&mut self, extension: impl Into<Arc<Extension>>)
fn use_extension(&mut self, extension: impl Into<Arc<Extension>>)
Registers a new extension in the set used by the hugr, keeping the one
most recent one if the extension already exists. Read more
Source§fn use_extensions<Reg>(&mut self, registry: impl IntoIterator<Item = Reg>)where
ExtensionRegistry: Extend<Reg>,
fn use_extensions<Reg>(&mut self, registry: impl IntoIterator<Item = Reg>)where
ExtensionRegistry: Extend<Reg>,
Extend the set of extensions used by the hugr with the extensions in the
registry. Read more
Source§impl<H: HugrMutInternals> HugrMutInternals for Rerooted<H>
impl<H: HugrMutInternals> HugrMutInternals for Rerooted<H>
Source§fn set_module_root(&mut self, root: Self::Node)
fn set_module_root(&mut self, root: Self::Node)
Set the node at the root of the HUGR hierarchy. Read more
Source§fn set_num_ports(&mut self, node: Self::Node, incoming: usize, outgoing: usize)
fn set_num_ports(&mut self, node: Self::Node, incoming: usize, outgoing: usize)
Set the number of ports on a node. This may invalidate the node’s
PortIndex
. Read moreSource§fn add_ports(
&mut self,
node: Self::Node,
direction: Direction,
amount: isize,
) -> Range<usize>
fn add_ports( &mut self, node: Self::Node, direction: Direction, amount: isize, ) -> Range<usize>
Alter the number of ports on a node and returns a range with the new
port offsets, if any. This may invalidate the node’s
PortIndex
. Read moreSource§fn insert_ports(
&mut self,
node: Self::Node,
direction: Direction,
index: usize,
amount: usize,
) -> Range<usize>
fn insert_ports( &mut self, node: Self::Node, direction: Direction, index: usize, amount: usize, ) -> Range<usize>
Insert
amount
new ports for a node, starting at index
. The
direction
parameter specifies whether to add ports to the incoming or
outgoing list. Links from this node are preserved, even when ports are
renumbered by the insertion. Read moreSource§fn set_parent(&mut self, node: Self::Node, parent: Self::Node)
fn set_parent(&mut self, node: Self::Node, parent: Self::Node)
Sets the parent of a node. Read more
Source§fn move_after_sibling(&mut self, node: Self::Node, after: Self::Node)
fn move_after_sibling(&mut self, node: Self::Node, after: Self::Node)
Move a node in the hierarchy to be the subsequent sibling of another
node. Read more
Source§fn move_before_sibling(&mut self, node: Self::Node, before: Self::Node)
fn move_before_sibling(&mut self, node: Self::Node, before: Self::Node)
Move a node in the hierarchy to be the prior sibling of another node. Read more
Source§fn replace_op(&mut self, node: Self::Node, op: impl Into<OpType>) -> OpType
fn replace_op(&mut self, node: Self::Node, op: impl Into<OpType>) -> OpType
Replace the
OpType
at node and return the old OpType
.
In general this invalidates the ports, which may need to be resized to
match the OpType
signature. Read moreSource§fn optype_mut(&mut self, node: Self::Node) -> &mut OpType
fn optype_mut(&mut self, node: Self::Node) -> &mut OpType
Gets a mutable reference to the optype. Read more
Source§fn node_metadata_map_mut(&mut self, node: Self::Node) -> &mut NodeMetadataMap
fn node_metadata_map_mut(&mut self, node: Self::Node) -> &mut NodeMetadataMap
Returns a metadata entry associated with a node. Read more
Source§fn extensions_mut(&mut self) -> &mut ExtensionRegistry
fn extensions_mut(&mut self) -> &mut ExtensionRegistry
Returns a mutable reference to the extension registry for this HUGR. Read more
Source§impl<H: HugrView> HugrView for Rerooted<H>
impl<H: HugrView> HugrView for Rerooted<H>
Source§fn entrypoint(&self) -> Self::Node
fn entrypoint(&self) -> Self::Node
The distinguished node from where operations are applied, commonly
defining a region of interest. Read more
Source§fn entrypoint_optype(&self) -> &OpType
fn entrypoint_optype(&self) -> &OpType
Returns the operation type of the entrypoint node.
Source§fn 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. Read moreSource§fn module_root(&self) -> Self::Node
fn module_root(&self) -> Self::Node
A pointer to the module region defined at the root of the HUGR. Read more
Source§fn contains_node(&self, node: Self::Node) -> bool
fn contains_node(&self, node: Self::Node) -> bool
Returns
true
if the node exists in the HUGR.Source§fn 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.
Source§fn get_optype(&self, node: Self::Node) -> &OpType
fn get_optype(&self, node: Self::Node) -> &OpType
Returns the operation type of a node. Read more
Source§fn 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.
Source§fn 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)
.Source§fn 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)
.Source§fn 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. Read more
Source§fn 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.
Source§fn 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.Source§fn 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.Source§fn 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.
Source§fn 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.
Source§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_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)>
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)>
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)>
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)>
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)>
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)>
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.Source§fn 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.Source§fn 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.
Source§fn 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.
Source§fn 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.
Source§fn 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. Read more
Source§fn 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.Source§fn 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.
Source§fn 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.Source§fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String
fn mermaid_string_with_config(&self, config: RenderConfig<Self::Node>) -> String
👎Deprecated: Use
mermaid_format
insteadReturn the mermaid representation of the underlying hierarchical graph. Read more
Source§fn dot_string(&self) -> String
fn dot_string(&self) -> String
Return the graphviz representation of the underlying graph and hierarchy side by side. Read more
Source§fn 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.
Source§fn 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.
Source§fn 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.
Source§fn extensions(&self) -> &ExtensionRegistry
fn extensions(&self) -> &ExtensionRegistry
Returns the set of extensions used by the HUGR. Read more
Source§fn validate(&self) -> Result<(), ValidationError<Self::Node>>
fn validate(&self) -> Result<(), ValidationError<Self::Node>>
Check the validity of the underlying HUGR.
Source§fn 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. Read more
Source§fn entrypoint_tag(&self) -> OpTag
fn entrypoint_tag(&self) -> OpTag
An operation tag that is guaranteed to represent the
HugrView::entrypoint
node operation. Read moreSource§fn 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. Read more
Source§fn 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. Read more
Source§fn 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)
.Source§fn 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)
.Source§fn 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
Source§fn inner_function_type(&self) -> Option<Cow<'_, Signature>>
fn inner_function_type(&self) -> Option<Cow<'_, Signature>>
Returns the function type defined by this dataflow HUGR. Read more
Source§fn poly_func_type(&self) -> Option<PolyFuncType>
fn poly_func_type(&self) -> Option<PolyFuncType>
Source§fn 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.
Source§fn mermaid_string(&self) -> String
fn mermaid_string(&self) -> String
Return the mermaid representation of the underlying hierarchical graph. Read more
Source§fn mermaid_format(&self) -> MermaidFormatter<'_, Self>
fn mermaid_format(&self) -> MermaidFormatter<'_, Self>
Construct a mermaid representation of the underlying hierarchical graph. Read more
Source§fn 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.
Source§fn 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.
Source§fn 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.
Auto Trait Implementations§
impl<H> Freeze for Rerooted<H>
impl<H> RefUnwindSafe for Rerooted<H>
impl<H> Send for Rerooted<H>
impl<H> Sync for Rerooted<H>
impl<H> Unpin for Rerooted<H>
impl<H> UnwindSafe for Rerooted<H>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self
, then passes self.deref()
into the pipe function.Source§impl<H, Handle> RootCheckable<H, Handle> for H
impl<H, Handle> RootCheckable<H, Handle> for H
Source§fn try_into_checked(self) -> Result<RootChecked<H, Handle>, HugrError>
fn try_into_checked(self) -> Result<RootChecked<H, Handle>, HugrError>
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref()
only in debug builds, and is erased in release
builds.