pub struct Hugr { /* private fields */ }
Expand description
The Hugr data structure.
Implementations§
Source§impl Hugr
impl Hugr
Sourcepub fn validate(&self) -> Result<(), ValidationError>
pub fn validate(&self) -> Result<(), ValidationError>
Check the validity of the HUGR, assuming that it has no open extension variables. TODO: Add a version of validation which allows for open extension variables (see github issue #457)
Sourcepub fn validate_no_extensions(&self) -> Result<(), ValidationError>
pub fn validate_no_extensions(&self) -> Result<(), ValidationError>
Check the validity of the HUGR, but don’t check consistency of extension requirements between connected nodes or between parents and children.
Sourcepub fn validate_extensions(&self) -> Result<(), ValidationError>
pub fn validate_extensions(&self) -> Result<(), ValidationError>
Validate extensions, i.e. that extension deltas from parent nodes are reflected in their children.
Source§impl Hugr
Public API for HUGRs.
impl Hugr
Public API for HUGRs.
Sourcepub fn load_json(
reader: impl Read,
extension_registry: &ExtensionRegistry,
) -> Result<Self, LoadHugrError>
pub fn load_json( reader: impl Read, extension_registry: &ExtensionRegistry, ) -> Result<Self, LoadHugrError>
Load a Hugr from a json reader.
Validates the Hugr against the provided extension registry, ensuring all operations are resolved.
If the feature extension_inference
is enabled, we will ensure every function
correctly specifies the extensions required by its contained ops.
Sourcepub fn infer_extensions(&mut self, remove: bool) -> Result<(), ExtensionError>
pub fn infer_extensions(&mut self, remove: bool) -> Result<(), ExtensionError>
Infers an extension-delta for any non-function container node whose current extension_delta contains TO_BE_INFERRED. The inferred delta will be the smallest delta compatible with its children and that includes any other ExtensionIds in the current delta.
If remove
is true, for such container nodes without TO_BE_INFERRED,
ExtensionIds are removed from the delta if they are not used by any child node.
The non-function container nodes are: Case, CFG, Conditional, DataflowBlock, DFG, TailLoop
Sourcepub fn resolve_extension_defs(
&mut self,
extensions: &ExtensionRegistry,
) -> Result<(), ExtensionResolutionError>
pub fn resolve_extension_defs( &mut self, extensions: &ExtensionRegistry, ) -> Result<(), ExtensionResolutionError>
Given a Hugr that has been deserialized, collect all extensions used to
define the HUGR while resolving all OpType::OpaqueOp
operations into
OpType::ExtensionOp
s and updating the extension pointer in all
internal crate::types::CustomType
s to point to the extensions in the
register.
When listing “used extensions” we only care about definitional extension requirements, i.e., the operations and types that are required to define the HUGR nodes and wire types. This is computed from the union of all extension required across the HUGR.
This is distinct from runtime extension requirements computed in
Hugr::infer_extensions
, which are computed more granularly in each
function signature by the runtime_reqs
field and define the set
of capabilities required by the runtime to execute each function.
Updates the internal extension registry with the extensions used in the definition.
§Parameters
extensions
: The extension set considered when resolving opaque operations and types. The original Hugr’s internal extension registry is ignored and replaced with the newly computed one.
§Errors
- If an opaque operation cannot be resolved to an extension operation.
- If an extension operation references an extension that is missing from the registry.
- If a custom type references an extension that is missing from the registry.
Source§impl Hugr
Internal API for HUGRs, not intended for use by users.
impl Hugr
Internal API for HUGRs, not intended for use by users.
Sourcepub fn canonicalize_nodes(&mut self, rekey: impl FnMut(Node, Node))
pub fn canonicalize_nodes(&mut self, rekey: impl FnMut(Node, Node))
Compact the nodes indices of the hugr to be contiguous, and order them as a breadth-first traversal of the hierarchy.
The rekey function is called for each moved node with the old and new indices.
After this operation, a serialization and deserialization of the Hugr is guaranteed to preserve the indices.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Hugr
impl<'de> Deserialize<'de> for Hugr
Source§fn deserialize<D>(deserializer: D) -> Result<Hugr, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Hugr, D::Error>where
D: Deserializer<'de>,
Source§impl ExtractHugr for &Hugr
impl ExtractHugr for &Hugr
Source§fn extract_hugr(self) -> Hugr
fn extract_hugr(self) -> Hugr
Source§impl ExtractHugr for &mut Hugr
impl ExtractHugr for &mut Hugr
Source§fn extract_hugr(self) -> Hugr
fn extract_hugr(self) -> Hugr
Source§impl ExtractHugr for Hugr
impl ExtractHugr for Hugr
Source§fn extract_hugr(self) -> Hugr
fn extract_hugr(self) -> Hugr
Source§impl HugrInternals for Hugr
impl HugrInternals for Hugr
Source§type Portgraph<'p> = &'p MultiPortGraph
where
Self: 'p
type Portgraph<'p> = &'p MultiPortGraph where Self: 'p
Source§fn get_pg_index(&self, node: Self::Node) -> NodeIndex
fn get_pg_index(&self, node: Self::Node) -> NodeIndex
Source§impl HugrView for Hugr
impl HugrView for Hugr
Source§fn contains_node(&self, node: Node) -> bool
fn contains_node(&self, node: Node) -> bool
Source§fn node_count(&self) -> usize
fn node_count(&self) -> usize
Source§fn edge_count(&self) -> usize
fn edge_count(&self) -> usize
Source§fn nodes(&self) -> impl Iterator<Item = Node> + Clone
fn nodes(&self) -> impl Iterator<Item = Node> + Clone
Source§fn node_ports(
&self,
node: Node,
dir: Direction,
) -> impl Iterator<Item = Port> + Clone
fn node_ports( &self, node: Node, dir: Direction, ) -> impl Iterator<Item = Port> + Clone
Source§fn all_node_ports(&self, node: Node) -> impl Iterator<Item = Port> + Clone
fn all_node_ports(&self, node: Node) -> impl Iterator<Item = Port> + Clone
Source§fn linked_ports(
&self,
node: Node,
port: impl Into<Port>,
) -> impl Iterator<Item = (Node, Port)> + Clone
fn linked_ports( &self, node: Node, port: impl Into<Port>, ) -> impl Iterator<Item = (Node, Port)> + Clone
Source§fn node_connections(
&self,
node: Node,
other: Node,
) -> impl Iterator<Item = [Port; 2]> + Clone
fn node_connections( &self, node: Node, other: Node, ) -> impl Iterator<Item = [Port; 2]> + Clone
Source§fn num_ports(&self, node: Node, dir: Direction) -> usize
fn num_ports(&self, node: Node, dir: Direction) -> usize
Source§fn children(&self, node: Node) -> impl DoubleEndedIterator<Item = Node> + Clone
fn children(&self, node: Node) -> impl DoubleEndedIterator<Item = Node> + Clone
Source§fn neighbours(
&self,
node: Node,
dir: Direction,
) -> impl Iterator<Item = Node> + Clone
fn neighbours( &self, node: Node, dir: Direction, ) -> impl Iterator<Item = Node> + Clone
Source§fn all_neighbours(&self, node: Node) -> impl Iterator<Item = Node> + Clone
fn all_neighbours(&self, node: Node) -> impl Iterator<Item = Node> + Clone
node
in sequence.Source§fn valid_node(&self, node: Self::Node) -> bool
fn valid_node(&self, node: Self::Node) -> bool
Source§fn valid_non_root(&self, node: Self::Node) -> bool
fn valid_non_root(&self, node: Self::Node) -> bool
Source§fn get_optype(&self, node: Self::Node) -> &OpType
fn get_optype(&self, node: Self::Node) -> &OpType
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>
Source§fn get_node_metadata(&self, node: Self::Node) -> Option<&NodeMetadataMap>
fn get_node_metadata(&self, node: Self::Node) -> Option<&NodeMetadataMap>
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
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
fn node_inputs( &self, node: Self::Node, ) -> impl Iterator<Item = IncomingPort> + Clone
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)>> ⓘ
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)>
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)>
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)>
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)>
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)>
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)>
fn linked_outputs( &self, node: Self::Node, port: impl Into<IncomingPort>, ) -> impl Iterator<Item = (Self::Node, OutgoingPort)>
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)>
fn linked_inputs( &self, node: Self::Node, port: impl Into<OutgoingPort>, ) -> impl Iterator<Item = (Self::Node, IncomingPort)>
linked_ports
but preserves knowledge
that the linked ports are IncomingPorts.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
Source§fn num_inputs(&self, node: Self::Node) -> usize
fn num_inputs(&self, node: Self::Node) -> usize
num_ports
(node, Direction::Incoming)
.Source§fn num_outputs(&self, node: Self::Node) -> usize
fn num_outputs(&self, node: Self::Node) -> usize
num_ports
(node, Direction::Outgoing)
.Source§fn first_child(&self, node: Self::Node) -> Option<Self::Node>
fn first_child(&self, node: Self::Node) -> Option<Self::Node>
x.children().next()
leaves x borrowed.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
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
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]>
Source§fn inner_function_type(&self) -> Option<Cow<'_, Signature>>
fn inner_function_type(&self) -> Option<Cow<'_, Signature>>
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,
Source§fn mermaid_string(&self) -> String
fn mermaid_string(&self) -> String
Source§fn mermaid_string_with_config(&self, config: RenderConfig) -> String
fn mermaid_string_with_config(&self, config: RenderConfig) -> String
Source§fn dot_string(&self) -> Stringwhere
Self: Sized,
fn dot_string(&self) -> Stringwhere
Self: Sized,
Source§fn static_source(&self, node: Self::Node) -> Option<Self::Node>
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)>>
fn static_targets( &self, node: Self::Node, ) -> Option<impl Iterator<Item = (Self::Node, IncomingPort)>>
Source§fn signature(&self, node: Self::Node) -> Option<Cow<'_, Signature>>
fn signature(&self, node: Self::Node) -> Option<Cow<'_, Signature>>
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)>
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)>
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)>
Source§fn extensions(&self) -> &ExtensionRegistry
fn extensions(&self) -> &ExtensionRegistry
Source§fn validate(&self) -> Result<(), ValidationError>
fn validate(&self) -> Result<(), ValidationError>
Source§fn validate_no_extensions(&self) -> Result<(), ValidationError>
fn validate_no_extensions(&self) -> Result<(), ValidationError>
Source§impl RootTagged for &Hugr
impl RootTagged for &Hugr
Source§type RootHandle = Node
type RootHandle = Node
Source§impl RootTagged for &mut Hugr
impl RootTagged for &mut Hugr
Source§type RootHandle = Node
type RootHandle = Node
Source§impl RootTagged for Hugr
impl RootTagged for Hugr
Source§type RootHandle = Node
type RootHandle = Node
impl StructuralPartialEq for Hugr
Auto Trait Implementations§
impl !Freeze for Hugr
impl !RefUnwindSafe for Hugr
impl Send for Hugr
impl Sync for Hugr
impl Unpin for Hugr
impl !UnwindSafe for Hugr
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
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>
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>
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)
&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)
&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,
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,
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,
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,
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,
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,
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,
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,
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<T> HugrMut for T
impl<T> HugrMut for T
Source§fn add_node_with_parent(
&mut self,
parent: Node,
node: impl Into<OpType>,
) -> Node
fn add_node_with_parent( &mut self, parent: Node, node: impl Into<OpType>, ) -> Node
Source§fn add_node_before(
&mut self,
sibling: Node,
nodetype: impl Into<OpType>,
) -> Node
fn add_node_before( &mut self, sibling: Node, nodetype: impl Into<OpType>, ) -> Node
Source§fn add_node_after(&mut self, sibling: Node, op: impl Into<OpType>) -> Node
fn add_node_after(&mut self, sibling: Node, op: impl Into<OpType>) -> Node
Source§fn remove_node(&mut self, node: Node) -> OpType
fn remove_node(&mut self, node: Node) -> OpType
Source§fn connect(
&mut self,
src: Node,
src_port: impl Into<OutgoingPort>,
dst: Node,
dst_port: impl Into<IncomingPort>,
)
fn connect( &mut self, src: Node, src_port: impl Into<OutgoingPort>, dst: Node, dst_port: impl Into<IncomingPort>, )
Source§fn disconnect(&mut self, node: Node, port: impl Into<Port>)
fn disconnect(&mut self, node: Node, port: impl Into<Port>)
Source§fn add_other_edge(
&mut self,
src: Node,
dst: Node,
) -> (OutgoingPort, IncomingPort)
fn add_other_edge( &mut self, src: Node, dst: Node, ) -> (OutgoingPort, IncomingPort)
OpTrait::other_input
or OpTrait::other_output
. Read moreSource§fn insert_hugr(&mut self, root: Node, other: Hugr) -> InsertionResult
fn insert_hugr(&mut self, root: Node, other: Hugr) -> InsertionResult
Source§fn insert_from_view(
&mut self,
root: Node,
other: &impl HugrView,
) -> InsertionResult
fn insert_from_view( &mut self, root: Node, other: &impl HugrView, ) -> InsertionResult
Source§fn insert_subgraph(
&mut self,
root: Node,
other: &impl HugrView,
subgraph: &SiblingSubgraph,
) -> HashMap<Node, Node>
fn insert_subgraph( &mut self, root: Node, other: &impl HugrView, subgraph: &SiblingSubgraph, ) -> HashMap<Node, Node>
Source§fn copy_descendants(
&mut self,
root: Node,
new_parent: Node,
subst: Option<Substitution<'_>>,
) -> BTreeMap<Node, Node>
fn copy_descendants( &mut self, root: Node, new_parent: Node, subst: Option<Substitution<'_>>, ) -> BTreeMap<Node, Node>
root
to under the new_parent
, optionally applying a
Substitution to the OpTypes of the copied nodes. Read moreSource§fn get_metadata_mut(
&mut self,
node: Node,
key: impl AsRef<str>,
) -> &mut NodeMetadata
fn get_metadata_mut( &mut self, node: Node, key: impl AsRef<str>, ) -> &mut NodeMetadata
Source§fn set_metadata(
&mut self,
node: Node,
key: impl AsRef<str>,
metadata: impl Into<NodeMetadata>,
)
fn set_metadata( &mut self, node: Node, key: impl AsRef<str>, metadata: impl Into<NodeMetadata>, )
Source§fn remove_metadata(&mut self, node: Node, key: impl AsRef<str>)
fn remove_metadata(&mut self, node: Node, key: impl AsRef<str>)
Source§fn take_node_metadata(&mut self, node: Self::Node) -> Option<NodeMetadataMap>
fn take_node_metadata(&mut self, node: Self::Node) -> Option<NodeMetadataMap>
Source§fn overwrite_node_metadata(
&mut self,
node: Node,
metadata: Option<NodeMetadataMap>,
)
fn overwrite_node_metadata( &mut self, node: Node, metadata: Option<NodeMetadataMap>, )
Source§fn remove_subtree(&mut self, node: Node)
fn remove_subtree(&mut self, node: Node)
Source§fn apply_rewrite<R, E>(
&mut self,
rw: impl Rewrite<ApplyResult = R, Error = E>,
) -> Result<R, E>where
Self: Sized,
fn apply_rewrite<R, E>(
&mut self,
rw: impl Rewrite<ApplyResult = R, Error = E>,
) -> Result<R, E>where
Self: Sized,
Source§fn use_extension(&mut self, extension: impl Into<Arc<Extension>>)
fn use_extension(&mut self, extension: impl Into<Arc<Extension>>)
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>,
Source§fn extensions_mut(&mut self) -> &mut ExtensionRegistry
fn extensions_mut(&mut self) -> &mut ExtensionRegistry
Source§impl<T> HugrMutInternals for T
impl<T> HugrMutInternals for T
Source§fn set_num_ports(&mut self, node: Node, incoming: usize, outgoing: usize)
fn set_num_ports(&mut self, node: Node, incoming: usize, outgoing: usize)
PortIndex
. Read moreSource§fn insert_ports(
&mut self,
node: Node,
direction: Direction,
index: usize,
amount: usize,
) -> Range<usize>
fn insert_ports( &mut self, node: Node, direction: Direction, index: usize, amount: usize, ) -> Range<usize>
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 add_ports(
&mut self,
node: Node,
direction: Direction,
amount: isize,
) -> Range<usize>
fn add_ports( &mut self, node: Node, direction: Direction, amount: isize, ) -> Range<usize>
PortIndex
. Read moreSource§fn move_after_sibling(&mut self, node: Node, after: Node)
fn move_after_sibling(&mut self, node: Node, after: Node)
Source§fn move_before_sibling(&mut self, node: Node, before: Node)
fn move_before_sibling(&mut self, node: Node, before: Node)
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> ⓘ
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> ⓘ
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,
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,
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,
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
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
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
self
, then passes self.deref()
into the pipe function.Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
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
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
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
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
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
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
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
.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
.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
.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
.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
.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
.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
.tap_deref()
only in debug builds, and is erased in release
builds.