pub struct PortGraph<N: IndexBase = u32, P: IndexBase = u32, PO: IndexBase = u16> { /* private fields */ }Expand description
An unlabelled port graph.
A port graph consists of a collection of nodes identified by a NodeIndex.
Each node has an ordered sequence of input and output ports, identified by a PortIndex that is unique within the graph.
To optimize for the most common use case, the number of input and output ports of a node must be specified when the node is created.
When a node and its associated ports are removed their indices will be reused on a best effort basis
when a new node is added.
The indices of unaffected nodes and ports remain stable.
PortGraph::compact_nodes and PortGraph::compact_ports to eliminate fragmentation in the index space.
§Generic parameters
N: The unsigned integer type used for node indices.P: The unsigned integer type used for port indices.PO: The unsigned integer type used for port offsets.
Implementations§
Trait Implementations§
Source§impl<N: Clone + IndexBase, P: Clone + IndexBase, PO: Clone + IndexBase> Clone for PortGraph<N, P, PO>
impl<N: Clone + IndexBase, P: Clone + IndexBase, PO: Clone + IndexBase> Clone for PortGraph<N, P, PO>
Source§impl<N: IndexBase, P: IndexBase, PO: IndexBase> From<MultiPortGraph<N, P, PO>> for PortGraph<N, P, PO>
impl<N: IndexBase, P: IndexBase, PO: IndexBase> From<MultiPortGraph<N, P, PO>> for PortGraph<N, P, PO>
Source§fn from(multi: MultiPortGraph<N, P, PO>) -> Self
fn from(multi: MultiPortGraph<N, P, PO>) -> Self
Converts to this type from the input type.
Source§impl<N: IndexBase, P: IndexBase, PO: IndexBase> From<PortGraph<N, P, PO>> for MultiPortGraph<N, P, PO>
impl<N: IndexBase, P: IndexBase, PO: IndexBase> From<PortGraph<N, P, PO>> for MultiPortGraph<N, P, PO>
Source§impl<N: IndexBase, P: IndexBase, PO: IndexBase> LinkMut for PortGraph<N, P, PO>
impl<N: IndexBase, P: IndexBase, PO: IndexBase> LinkMut for PortGraph<N, P, PO>
Source§fn link_ports(
&mut self,
port_a: PortIndex<P>,
port_b: PortIndex<P>,
) -> Result<(Self::LinkEndpoint, Self::LinkEndpoint), LinkError<N, P, PO>>
fn link_ports( &mut self, port_a: PortIndex<P>, port_b: PortIndex<P>, ) -> Result<(Self::LinkEndpoint, Self::LinkEndpoint), LinkError<N, P, PO>>
Link an output port to an input port. Read more
Source§fn unlink_port(&mut self, port: PortIndex<P>) -> Option<PortIndex<P>>
fn unlink_port(&mut self, port: PortIndex<P>) -> Option<PortIndex<P>>
Unlinks all connections to the
port. If the port was connected,
returns one of the ports it was connected to.Source§fn link_nodes(
&mut self,
from: NodeIndex<Self::NodeIndexBase>,
from_output: usize,
to: NodeIndex<Self::NodeIndexBase>,
to_input: usize,
) -> Result<(Self::LinkEndpoint, Self::LinkEndpoint), LinkError<Self::NodeIndexBase, Self::PortIndexBase, Self::PortOffsetBase>>
fn link_nodes( &mut self, from: NodeIndex<Self::NodeIndexBase>, from_output: usize, to: NodeIndex<Self::NodeIndexBase>, to_input: usize, ) -> Result<(Self::LinkEndpoint, Self::LinkEndpoint), LinkError<Self::NodeIndexBase, Self::PortIndexBase, Self::PortOffsetBase>>
Links two nodes at an input and output port offsets. Read more
Source§fn link_offsets(
&mut self,
node_a: NodeIndex<Self::NodeIndexBase>,
offset_a: PortOffset<Self::PortOffsetBase>,
node_b: NodeIndex<Self::NodeIndexBase>,
offset_b: PortOffset<Self::PortOffsetBase>,
) -> Result<(Self::LinkEndpoint, Self::LinkEndpoint), LinkError<Self::NodeIndexBase, Self::PortIndexBase, Self::PortOffsetBase>>
fn link_offsets( &mut self, node_a: NodeIndex<Self::NodeIndexBase>, offset_a: PortOffset<Self::PortOffsetBase>, node_b: NodeIndex<Self::NodeIndexBase>, offset_b: PortOffset<Self::PortOffsetBase>, ) -> Result<(Self::LinkEndpoint, Self::LinkEndpoint), LinkError<Self::NodeIndexBase, Self::PortIndexBase, Self::PortOffsetBase>>
Links two nodes at an input and output port offsets. Read more
Source§fn insert_graph(
&mut self,
other: &impl LinkView<NodeIndexBase = Self::NodeIndexBase, PortIndexBase = Self::PortIndexBase, PortOffsetBase = Self::PortOffsetBase>,
) -> Result<HashMap<NodeIndex<Self::NodeIndexBase>, NodeIndex<Self::NodeIndexBase>>, LinkError<Self::NodeIndexBase, Self::PortIndexBase, Self::PortOffsetBase>>
fn insert_graph( &mut self, other: &impl LinkView<NodeIndexBase = Self::NodeIndexBase, PortIndexBase = Self::PortIndexBase, PortOffsetBase = Self::PortOffsetBase>, ) -> Result<HashMap<NodeIndex<Self::NodeIndexBase>, NodeIndex<Self::NodeIndexBase>>, LinkError<Self::NodeIndexBase, Self::PortIndexBase, Self::PortOffsetBase>>
Inserts another graph into this graph. Read more
Source§impl<N: IndexBase, P: IndexBase, PO: IndexBase> LinkView for PortGraph<N, P, PO>
impl<N: IndexBase, P: IndexBase, PO: IndexBase> LinkView for PortGraph<N, P, PO>
Source§type LinkEndpoint = PortIndex<P>
type LinkEndpoint = PortIndex<P>
The identifier for the endpoints of a link.
Source§fn port_links(
&self,
port: PortIndex<P>,
) -> impl Iterator<Item = (PortIndex<P>, PortIndex<P>)> + Clone
fn port_links( &self, port: PortIndex<P>, ) -> impl Iterator<Item = (PortIndex<P>, PortIndex<P>)> + Clone
Returns the port (or ports if this is a
MultiView) that the given port is linked to.Source§fn link_count(&self) -> usize
fn link_count(&self) -> usize
Returns the number of links between ports.
Source§fn get_connections(
&self,
from: NodeIndex<N>,
to: NodeIndex<N>,
) -> impl Iterator<Item = (Self::LinkEndpoint, Self::LinkEndpoint)> + Clone
fn get_connections( &self, from: NodeIndex<N>, to: NodeIndex<N>, ) -> impl Iterator<Item = (Self::LinkEndpoint, Self::LinkEndpoint)> + Clone
Returns an iterator over every pair of matching ports connecting
from
to to, i.e. in that direction. Read moreSource§fn links(
&self,
node: NodeIndex<N>,
direction: Direction,
) -> impl Iterator<Item = (Self::LinkEndpoint, Self::LinkEndpoint)> + Clone
fn links( &self, node: NodeIndex<N>, direction: Direction, ) -> impl Iterator<Item = (Self::LinkEndpoint, Self::LinkEndpoint)> + Clone
Source§fn all_links(
&self,
node: NodeIndex<N>,
) -> impl Iterator<Item = (Self::LinkEndpoint, Self::LinkEndpoint)> + Clone
fn all_links( &self, node: NodeIndex<N>, ) -> impl Iterator<Item = (Self::LinkEndpoint, Self::LinkEndpoint)> + Clone
Iterates over the connected input and output links of the
node in sequence.Source§fn neighbours(
&self,
node: NodeIndex<N>,
direction: Direction,
) -> impl Iterator<Item = NodeIndex<N>> + Clone
fn neighbours( &self, node: NodeIndex<N>, direction: Direction, ) -> impl Iterator<Item = NodeIndex<N>> + Clone
Iterates over neighbour nodes in the given
direction.
May contain duplicates if the graph has multiple links between nodes. Read moreSource§fn all_neighbours(
&self,
node: NodeIndex<N>,
) -> impl Iterator<Item = NodeIndex<N>> + Clone
fn all_neighbours( &self, node: NodeIndex<N>, ) -> impl Iterator<Item = NodeIndex<N>> + Clone
Iterates over the input and output neighbours of the
node in sequence.Source§fn get_connection(
&self,
from: NodeIndex<Self::NodeIndexBase>,
to: NodeIndex<Self::NodeIndexBase>,
) -> Option<(Self::LinkEndpoint, Self::LinkEndpoint)>
fn get_connection( &self, from: NodeIndex<Self::NodeIndexBase>, to: NodeIndex<Self::NodeIndexBase>, ) -> Option<(Self::LinkEndpoint, Self::LinkEndpoint)>
Checks whether there is a directed link between the two nodes and
returns the first matching pair of ports. Read more
Source§fn connected(
&self,
from: NodeIndex<Self::NodeIndexBase>,
to: NodeIndex<Self::NodeIndexBase>,
) -> bool
fn connected( &self, from: NodeIndex<Self::NodeIndexBase>, to: NodeIndex<Self::NodeIndexBase>, ) -> bool
Checks whether there is a directed link between the two nodes. Read more
Source§fn port_link(
&self,
port: PortIndex<Self::PortIndexBase>,
) -> Option<Self::LinkEndpoint>
fn port_link( &self, port: PortIndex<Self::PortIndexBase>, ) -> Option<Self::LinkEndpoint>
Return the link to the provided port, if not connected return None.
If this port has multiple connected subports, an arbitrary one is returned.
Source§fn input_links(
&self,
node: NodeIndex<Self::NodeIndexBase>,
) -> impl Iterator<Item = (Self::LinkEndpoint, Self::LinkEndpoint)> + Clone
fn input_links( &self, node: NodeIndex<Self::NodeIndexBase>, ) -> impl Iterator<Item = (Self::LinkEndpoint, Self::LinkEndpoint)> + Clone
Iterates over the connected input links of the
node. Shorthand for
LinkView::links(Direction::Incoming).Source§fn output_links(
&self,
node: NodeIndex<Self::NodeIndexBase>,
) -> impl Iterator<Item = (Self::LinkEndpoint, Self::LinkEndpoint)> + Clone
fn output_links( &self, node: NodeIndex<Self::NodeIndexBase>, ) -> impl Iterator<Item = (Self::LinkEndpoint, Self::LinkEndpoint)> + Clone
Iterates over the connected output links of the
node. Shorthand for
LinkView::links(Direction::Outgoing).Source§fn input_neighbours(
&self,
node: NodeIndex<Self::NodeIndexBase>,
) -> impl Iterator<Item = NodeIndex<Self::NodeIndexBase>> + Clone
fn input_neighbours( &self, node: NodeIndex<Self::NodeIndexBase>, ) -> impl Iterator<Item = NodeIndex<Self::NodeIndexBase>> + Clone
Iterates over the input neighbours of the
node. Read moreSource§fn output_neighbours(
&self,
node: NodeIndex<Self::NodeIndexBase>,
) -> impl Iterator<Item = NodeIndex<Self::NodeIndexBase>> + Clone
fn output_neighbours( &self, node: NodeIndex<Self::NodeIndexBase>, ) -> impl Iterator<Item = NodeIndex<Self::NodeIndexBase>> + Clone
Iterates over the output neighbours of the
node. Read moreSource§impl<N: PartialEq + IndexBase, P: PartialEq + IndexBase, PO: PartialEq + IndexBase> PartialEq for PortGraph<N, P, PO>
impl<N: PartialEq + IndexBase, P: PartialEq + IndexBase, PO: PartialEq + IndexBase> PartialEq for PortGraph<N, P, PO>
Source§impl<N: IndexBase, P: IndexBase, PO: IndexBase> PortMut for PortGraph<N, P, PO>
impl<N: IndexBase, P: IndexBase, PO: IndexBase> PortMut for PortGraph<N, P, PO>
Source§fn add_node(&mut self, incoming: usize, outgoing: usize) -> NodeIndex<N>
fn add_node(&mut self, incoming: usize, outgoing: usize) -> NodeIndex<N>
Adds a node to the portgraph with a given number of input and output ports. Read more
Source§fn remove_node(&mut self, node: NodeIndex<N>)
fn remove_node(&mut self, node: NodeIndex<N>)
Remove a node from the port graph. All ports of the node will be
unlinked and removed as well. Does nothing if the node does not exist. Read more
Source§fn reserve(&mut self, nodes: usize, ports: usize)
fn reserve(&mut self, nodes: usize, ports: usize)
Reserves enough capacity to insert at least the given number of additional nodes and ports. Read more
Source§fn set_num_ports<F>(
&mut self,
node: NodeIndex<N>,
incoming: usize,
outgoing: usize,
rekey: F,
)
fn set_num_ports<F>( &mut self, node: NodeIndex<N>, incoming: usize, outgoing: usize, rekey: F, )
Source§fn compact_nodes<F>(&mut self, rekey: F)
fn compact_nodes<F>(&mut self, rekey: F)
Compacts the storage of nodes in the portgraph as much as possible. Note
that node indices won’t necessarily be consecutive after this process. Read more
Source§fn swap_nodes(&mut self, a: NodeIndex<N>, b: NodeIndex<N>)
fn swap_nodes(&mut self, a: NodeIndex<N>, b: NodeIndex<N>)
Swaps the indices of two nodes.
Source§fn compact_ports<F>(&mut self, rekey: F)
fn compact_ports<F>(&mut self, rekey: F)
Compacts the storage of ports in the portgraph as much as possible. Note
that indices won’t necessarily be consecutive after this process. Read more
Source§fn shrink_to_fit(&mut self)
fn shrink_to_fit(&mut self)
Shrinks the underlying buffers to the fit the data. Read more
Source§impl<N: IndexBase, P: IndexBase, PO: IndexBase> PortView for PortGraph<N, P, PO>
impl<N: IndexBase, P: IndexBase, PO: IndexBase> PortView for PortGraph<N, P, PO>
Source§type NodeIndexBase = N
type NodeIndexBase = N
The base unsigned integer type for node indices.
Source§type PortIndexBase = P
type PortIndexBase = P
The base unsigned integer type for port indices.
Source§type PortOffsetBase = PO
type PortOffsetBase = PO
The base unsigned integer type for port offsets.
Source§fn port_direction(&self, port: impl Into<PortIndex<P>>) -> Option<Direction>
fn port_direction(&self, port: impl Into<PortIndex<P>>) -> Option<Direction>
Returns the direction of the
port.Source§fn port_node(&self, port: impl Into<PortIndex<P>>) -> Option<NodeIndex<N>>
fn port_node(&self, port: impl Into<PortIndex<P>>) -> Option<NodeIndex<N>>
Returns the node that the
port belongs to.Source§fn port_offset(&self, port: impl Into<PortIndex<P>>) -> Option<PortOffset<PO>>
fn port_offset(&self, port: impl Into<PortIndex<P>>) -> Option<PortOffset<PO>>
Returns the index of a
port within its node’s port list.Source§fn port_index(
&self,
node: NodeIndex<N>,
offset: PortOffset<PO>,
) -> Option<PortIndex<P>>
fn port_index( &self, node: NodeIndex<N>, offset: PortOffset<PO>, ) -> Option<PortIndex<P>>
Returns the port index for a given node and offset.
Source§fn input(&self, node: NodeIndex<N>, offset: usize) -> Option<PortIndex<P>>
fn input(&self, node: NodeIndex<N>, offset: usize) -> Option<PortIndex<P>>
Returns the input port at the given offset in the
node. Read moreSource§fn output(&self, node: NodeIndex<N>, offset: usize) -> Option<PortIndex<P>>
fn output(&self, node: NodeIndex<N>, offset: usize) -> Option<PortIndex<P>>
Returns the output port at the given offset in the
node. Read moreSource§fn num_ports(&self, node: NodeIndex<N>, direction: Direction) -> usize
fn num_ports(&self, node: NodeIndex<N>, direction: Direction) -> usize
Returns the number of ports of the
node in the given direction.Source§fn contains_node(&self, node: NodeIndex<N>) -> bool
fn contains_node(&self, node: NodeIndex<N>) -> bool
Returns whether the port graph contains the
node.Source§fn contains_port(&self, port: PortIndex<P>) -> bool
fn contains_port(&self, port: PortIndex<P>) -> bool
Returns whether the port graph contains the
port.Source§fn node_count(&self) -> usize
fn node_count(&self) -> usize
Returns the number of nodes in the port graph.
Source§fn port_count(&self) -> usize
fn port_count(&self) -> usize
Returns the number of ports in the port graph.
Source§fn node_capacity(&self) -> usize
fn node_capacity(&self) -> usize
Returns the capacity of the underlying buffer for nodes.
Source§fn port_capacity(&self) -> usize
fn port_capacity(&self) -> usize
Returns the capacity of the underlying buffer for ports.
Source§fn node_port_capacity(&self, node: NodeIndex<N>) -> usize
fn node_port_capacity(&self, node: NodeIndex<N>) -> usize
Returns the allocated port capacity for a specific node. Read more
Source§fn ports(
&self,
node: NodeIndex<N>,
direction: Direction,
) -> impl Iterator<Item = PortIndex<P>> + Clone
fn ports( &self, node: NodeIndex<N>, direction: Direction, ) -> impl Iterator<Item = PortIndex<P>> + Clone
Iterates over all the ports of the
node in the given direction.Source§fn all_ports(
&self,
node: NodeIndex<N>,
) -> impl Iterator<Item = PortIndex<P>> + Clone
fn all_ports( &self, node: NodeIndex<N>, ) -> impl Iterator<Item = PortIndex<P>> + Clone
Iterates over the input and output ports of the
node in sequence.Source§fn port_offsets(
&self,
node: NodeIndex<N>,
direction: Direction,
) -> impl Iterator<Item = PortOffset<PO>> + Clone
fn port_offsets( &self, node: NodeIndex<N>, direction: Direction, ) -> impl Iterator<Item = PortOffset<PO>> + Clone
Source§fn all_port_offsets(
&self,
node: NodeIndex<N>,
) -> impl Iterator<Item = PortOffset<PO>> + Clone
fn all_port_offsets( &self, node: NodeIndex<N>, ) -> impl Iterator<Item = PortOffset<PO>> + Clone
Iterates over the input and output port offsets of the
node in sequence.Source§fn nodes_iter(&self) -> impl Iterator<Item = NodeIndex<N>> + Clone
fn nodes_iter(&self) -> impl Iterator<Item = NodeIndex<N>> + Clone
Iterates over the nodes in the port graph.
Source§fn ports_iter(&self) -> impl Iterator<Item = PortIndex<P>> + Clone
fn ports_iter(&self) -> impl Iterator<Item = PortIndex<P>> + Clone
Iterates over the ports in the port graph.
Source§fn inputs(
&self,
node: NodeIndex<Self::NodeIndexBase>,
) -> impl Iterator<Item = PortIndex<Self::PortIndexBase>> + Clone
fn inputs( &self, node: NodeIndex<Self::NodeIndexBase>, ) -> impl Iterator<Item = PortIndex<Self::PortIndexBase>> + Clone
Iterates over all the input ports of the
node. Read moreSource§fn outputs(
&self,
node: NodeIndex<Self::NodeIndexBase>,
) -> impl Iterator<Item = PortIndex<Self::PortIndexBase>> + Clone
fn outputs( &self, node: NodeIndex<Self::NodeIndexBase>, ) -> impl Iterator<Item = PortIndex<Self::PortIndexBase>> + Clone
Iterates over all the output ports of the
node. Read moreSource§fn num_inputs(&self, node: NodeIndex<Self::NodeIndexBase>) -> usize
fn num_inputs(&self, node: NodeIndex<Self::NodeIndexBase>) -> usize
Returns the number of input ports of the
node. Read moreSource§fn num_outputs(&self, node: NodeIndex<Self::NodeIndexBase>) -> usize
fn num_outputs(&self, node: NodeIndex<Self::NodeIndexBase>) -> usize
Returns the number of output ports of the
node. Read moreSource§fn input_offsets(
&self,
node: NodeIndex<Self::NodeIndexBase>,
) -> impl Iterator<Item = PortOffset<Self::PortOffsetBase>> + Clone
fn input_offsets( &self, node: NodeIndex<Self::NodeIndexBase>, ) -> impl Iterator<Item = PortOffset<Self::PortOffsetBase>> + Clone
Iterates over all the input port offsets of the
node. Read moreSource§fn output_offsets(
&self,
node: NodeIndex<Self::NodeIndexBase>,
) -> impl Iterator<Item = PortOffset<Self::PortOffsetBase>> + Clone
fn output_offsets( &self, node: NodeIndex<Self::NodeIndexBase>, ) -> impl Iterator<Item = PortOffset<Self::PortOffsetBase>> + Clone
Iterates over all the output port offsets of the
node. Read moreimpl<N: IndexBase, P: IndexBase, PO: IndexBase> StructuralPartialEq for PortGraph<N, P, PO>
Auto Trait Implementations§
impl<N, P, PO> Freeze for PortGraph<N, P, PO>where
N: Freeze,
impl<N, P, PO> RefUnwindSafe for PortGraph<N, P, PO>where
PO: RefUnwindSafe,
N: RefUnwindSafe,
<PO as IndexBase>::NonZero: RefUnwindSafe,
P: RefUnwindSafe,
impl<N, P, PO> Send for PortGraph<N, P, PO>
impl<N, P, PO> Sync for PortGraph<N, P, PO>
impl<N, P, PO> Unpin for PortGraph<N, P, PO>
impl<N, P, PO> UnsafeUnpin for PortGraph<N, P, PO>where
N: UnsafeUnpin,
impl<N, P, PO> UnwindSafe for PortGraph<N, P, PO>
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<G> DotFormat for Gwhere
G: LinkView,
impl<G> DotFormat for Gwhere
G: LinkView,
Source§fn dot_format(&self) -> DotFormatter<'_, G>
fn dot_format(&self) -> DotFormatter<'_, G>
Initialize a
DotFormatter for the graph.Source§fn dot_string(&self) -> String
fn dot_string(&self) -> String
Encode the graph in dot format.
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> 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<G> MermaidFormat for Gwhere
G: LinkView,
impl<G> MermaidFormat for Gwhere
G: LinkView,
Source§fn mermaid_format(&self) -> MermaidFormatter<'_, G>
fn mermaid_format(&self) -> MermaidFormatter<'_, G>
Initialize a
MermaidFormatter for the graph. Read moreSource§fn mermaid_string(&self) -> String
fn mermaid_string(&self) -> String
Encode the graph in mermaid format. See
MermaidFormat::mermaid_format for more control over the output
style. 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<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.