Struct hugr_core::hugr::Hugr

source ·
pub struct Hugr { /* private fields */ }
Expand description

The Hugr data structure.

Implementations§

source§

impl Hugr

source

pub fn validate( &self, extension_registry: &ExtensionRegistry, ) -> 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)

source

pub fn validate_no_extensions( &self, extension_registry: &ExtensionRegistry, ) -> Result<(), ValidationError>

Check the validity of the HUGR, but don’t check consistency of extension requirements between connected nodes or between parents and children.

source

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.

source

pub fn new(root_node: impl Into<OpType>) -> Self

Create a new Hugr, with a single root node.

source

pub fn update_validate( &mut self, extension_registry: &ExtensionRegistry, ) -> Result<(), ValidationError>

Resolve extension ops, infer extensions used, and pass the closure into validation

source

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

source§

impl Hugr

Internal API for HUGRs, not intended for use by users.

source

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 AsMut<Hugr> for Hugr

source§

fn as_mut(&mut self) -> &mut Hugr

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<Hugr> for Hugr

source§

fn as_ref(&self) -> &Hugr

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<H: AsRef<Hugr>, Root> AsRef<Hugr> for RootChecked<H, Root>

source§

fn as_ref(&self) -> &Hugr

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for Hugr

source§

fn clone(&self) -> Hugr

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Hugr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Hugr

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Hugr

source§

fn deserialize<D>(deserializer: D) -> Result<Hugr, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl ExtractHugr for &Hugr

source§

fn extract_hugr(self) -> Hugr

Extracts the view into an owned HUGR, rooted at the view’s root node and containing only the nodes and edges of the view.
source§

impl ExtractHugr for &mut Hugr

source§

fn extract_hugr(self) -> Hugr

Extracts the view into an owned HUGR, rooted at the view’s root node and containing only the nodes and edges of the view.
source§

impl ExtractHugr for Hugr

source§

fn extract_hugr(self) -> Hugr

Extracts the view into an owned HUGR, rooted at the view’s root node and containing only the nodes and edges of the view.
source§

impl PartialEq for Hugr

source§

fn eq(&self, other: &Hugr) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl RootTagged for &Hugr

§

type RootHandle = Node

The kind of handle that can be used to refer to the root node. Read more
source§

impl RootTagged for &mut Hugr

§

type RootHandle = Node

The kind of handle that can be used to refer to the root node. Read more
source§

impl RootTagged for Hugr

§

type RootHandle = Node

The kind of handle that can be used to refer to the root node. Read more
source§

impl Serialize for Hugr

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> Conv for T

source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
source§

impl<T> Downcast for T
where T: Any,

source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &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)

Convert &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> DowncastSync for T
where T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> FmtForward for T

source§

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,

Causes self to use its Display implementation when Debug-formatted.
source§

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,

Causes self to use its LowerHex implementation when Debug-formatted.
source§

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,

Causes self to use its Pointer implementation when Debug-formatted.
source§

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,

Causes self to use its UpperHex implementation when Debug-formatted.
source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> HugrInternals for T
where T: AsRef<Hugr>,

§

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

The underlying portgraph view type.
source§

fn portgraph(&self) -> <T as HugrInternals>::Portgraph<'_>

Returns a reference to the underlying portgraph.
source§

fn base_hugr(&self) -> &Hugr

Returns the Hugr at the base of a chain of views.
source§

fn root_node(&self) -> Node

Return the root node of this view.
source§

impl<T> HugrMut for T
where T: RootTagged<RootHandle = Node> + AsMut<Hugr>,

source§

fn add_node_with_parent( &mut self, parent: Node, node: impl Into<OpType>, ) -> Node

Add a node to the graph with a parent in the hierarchy. Read more
source§

fn add_node_before( &mut self, sibling: Node, nodetype: impl Into<OpType>, ) -> Node

Add a node to the graph as the previous sibling of another node. Read more
source§

fn add_node_after(&mut self, sibling: Node, op: impl Into<OpType>) -> Node

Add a node to the graph as the next sibling of another node. Read more
source§

fn remove_node(&mut self, node: Node)

Remove a node from the graph. Read more
source§

fn connect( &mut self, src: Node, src_port: impl Into<OutgoingPort>, dst: Node, dst_port: impl Into<IncomingPort>, )

Connect two nodes at the given ports. Read more
source§

fn disconnect(&mut self, node: Node, port: impl Into<Port>)

Disconnects all edges from the given port. Read more
source§

fn add_other_edge( &mut self, src: Node, dst: 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 more
source§

fn insert_hugr(&mut self, root: Node, other: Hugr) -> InsertionResult

Insert another hugr into this one, under a given root node. Read more
source§

fn insert_from_view( &mut self, root: Node, other: &impl HugrView, ) -> InsertionResult

Copy another hugr into this one, under a given root node. Read more
source§

fn insert_subgraph( &mut self, root: Node, other: &impl HugrView, subgraph: &SiblingSubgraph, ) -> HashMap<Node, Node>

Copy a subgraph from another hugr into this one, under a given root node. Read more
source§

fn get_metadata_mut( &mut self, node: Node, key: impl AsRef<str>, ) -> &mut NodeMetadata

Returns a metadata entry associated with a node. Read more
source§

fn set_metadata( &mut self, node: Node, key: impl AsRef<str>, metadata: impl Into<NodeMetadata>, )

Sets a metadata value associated with a node. Read more
source§

fn take_node_metadata(&mut self, node: Node) -> Option<NodeMetadataMap>

Retrieve the complete metadata map for a node.
source§

fn overwrite_node_metadata( &mut self, node: Node, metadata: Option<NodeMetadataMap>, )

Overwrite the complete metadata map for a node. Read more
source§

fn apply_rewrite<R, E>( &mut self, rw: impl Rewrite<ApplyResult = R, Error = E>, ) -> Result<R, E>
where Self: Sized,

Applies a rewrite to the graph.
source§

impl<T> HugrMutInternals for T
where T: RootTagged<RootHandle = Node> + AsMut<Hugr>,

source§

fn hugr_mut(&mut self) -> &mut Hugr

Returns the Hugr at the base of a chain of views.
source§

fn set_num_ports(&mut self, node: Node, incoming: usize, outgoing: usize)

Set the number of ports on a node. This may invalidate the node’s PortIndex. Read more
source§

fn add_ports( &mut self, node: 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 more
source§

fn set_parent(&mut self, node: Node, parent: Node)

Sets the parent of a node. Read more
source§

fn move_after_sibling(&mut self, node: Node, after: 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: Node, before: Node)

Move a node in the hierarchy to be the prior sibling of another node. Read more
source§

fn replace_op( &mut self, node: Node, op: impl Into<OpType>, ) -> Result<OpType, HugrError>

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. TODO: Add a version which ignores input extensions Read more
source§

impl<T> HugrView for T
where T: AsRef<Hugr>,

§

type Nodes<'a> = MapSpecialCase<Nodes<'a>, MapSpecialCaseFnInto<Node>> where T: 'a

An Iterator over the nodes in a Hugr(View)

§

type NodePorts<'a> = MapSpecialCase<NodePortOffsets, MapSpecialCaseFnInto<Port>> where T: 'a

An Iterator over (some or all) ports of a node

§

type Children<'a> = MapSpecialCase<Children<'a>, MapSpecialCaseFnInto<Node>> where T: 'a

An Iterator over the children of a node

§

type Neighbours<'a> = MapSpecialCase<Neighbours<'a>, MapSpecialCaseFnInto<Node>> where T: 'a

An Iterator over (some or all) the nodes neighbouring a node

Iterator over the children of a node

§

type NodeConnections<'a> = MapCtx<WithCtx<NodeConnections<'a>, &'a Hugr>, [Port; 2]> where T: 'a

Iterator over the links between two nodes.
source§

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

Returns whether the node exists.
source§

fn node_count(&self) -> usize

Returns the number of nodes in the hugr.
source§

fn edge_count(&self) -> usize

Returns the number of edges in the hugr.
source§

fn nodes(&self) -> <T as HugrView>::Nodes<'_>

Iterates over the nodes in the port graph.
source§

fn node_ports( &self, node: Node, dir: Direction, ) -> <T as HugrView>::NodePorts<'_>

Iterator over ports of node in a given direction.
source§

fn all_node_ports(&self, node: Node) -> <T as HugrView>::NodePorts<'_>

Iterator over both the input and output ports of node.
source§

fn linked_ports( &self, node: Node, port: impl Into<Port>, ) -> <T as HugrView>::PortLinks<'_>

Iterator over the nodes and ports connected to a port.
source§

fn node_connections( &self, node: Node, other: Node, ) -> <T as HugrView>::NodeConnections<'_>

Iterator the links between two nodes.
source§

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

Number of ports in node for a given direction.
source§

fn children(&self, node: Node) -> <T as HugrView>::Children<'_>

Return iterator over the direct children of node.
source§

fn neighbours( &self, node: Node, dir: Direction, ) -> <T as HugrView>::Neighbours<'_>

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: Node) -> <T as HugrView>::Neighbours<'_>

Iterates over the input and output neighbours of the node in sequence.
source§

fn root(&self) -> Node

Return the root node of this view.
source§

fn root_type(&self) -> &OpType

Return the type of the HUGR root node.
source§

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

Validates that a node is valid in the graph.
source§

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

Validates that a node is a valid root descendant in the graph. Read more
source§

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

Returns the parent of a node.
source§

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

Returns the operation type of a node.
source§

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

Returns the metadata associated with a node.
source§

fn get_node_metadata(&self, node: Node) -> Option<&NodeMetadataMap>

Retrieve the complete metadata map for a node.
source§

fn node_outputs(&self, node: Node) -> OutgoingPorts<Self::NodePorts<'_>>

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: Node) -> IncomingPorts<Self::NodePorts<'_>>

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: Node, dir: Direction, ) -> Either<impl Iterator<Item = (Node, OutgoingPort)>, impl Iterator<Item = (Node, IncomingPort)>>

Iterator over all the nodes and ports connected to a node in a given direction.
source§

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

Iterator over all the nodes and ports connected to a node’s inputs.
source§

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

Iterator over all the nodes and ports connected to a node’s outputs.
source§

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

If there is exactly one port connected to this port, return it and its node.
source§

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

If there is exactly one OutgoingPort connected to this IncomingPort, return it and its node.
source§

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

If there is exactly one IncomingPort connected to this OutgoingPort, return it and its node.
source§

fn linked_outputs( &self, node: Node, port: impl Into<IncomingPort>, ) -> OutgoingNodePorts<Self::PortLinks<'_>>

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: Node, port: impl Into<OutgoingPort>, ) -> IncomingNodePorts<Self::PortLinks<'_>>

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: Node, port: impl Into<Port>) -> bool

Returns whether a port is connected.
source§

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

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

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

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

fn input_neighbours(&self, node: Node) -> Self::Neighbours<'_>

Iterates over the input neighbours of the node. Shorthand for neighbours(node, Direction::Incoming).
source§

fn output_neighbours(&self, node: Node) -> Self::Neighbours<'_>

Iterates over the output neighbours of the node. Shorthand for neighbours(node, Direction::Outgoing).
source§

fn get_io(&self, node: Node) -> Option<[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<Signature>

Returns the function type defined by this dataflow HUGR. Read more
source§

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

Returns the function type defined by this HUGR. Read more
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. Read more
source§

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

Return the mermaid representation of the underlying hierarchical graph. Read more
source§

fn dot_string(&self) -> String
where Self: Sized,

Return the graphviz representation of the underlying graph and hierarchy side by side. Read more
source§

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

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

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

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

fn signature(&self, node: Node) -> Option<Signature>

Get the “signature” (incoming and outgoing types) of a node, non-Value kind ports will be missing.
source§

fn value_types( &self, node: 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: 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: Node, ) -> impl Iterator<Item = (OutgoingPort, Type)>

Iterator over all incoming ports that have Value type, along with corresponding types.
source§

fn validate(&self, reg: &ExtensionRegistry) -> Result<(), ValidationError>

Check the validity of the underlying HUGR.
source§

fn validate_no_extensions( &self, reg: &ExtensionRegistry, ) -> Result<(), ValidationError>

Check the validity of the underlying HUGR, but don’t check consistency of extension requirements between connected nodes or between parents and children.
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
source§

impl<T> Pipe for T
where T: ?Sized,

source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where 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) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

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
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

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
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

source§

impl<T> Tap for T

source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
source§

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

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
where Self: Borrow<B>, B: ?Sized,

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
where Self: BorrowMut<B>, B: ?Sized,

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
where Self: AsRef<R>, R: ?Sized,

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
where Self: AsMut<R>, R: ?Sized,

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
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> TryConv for T

source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,