pub trait PortView {
type PortOffsetBase: Unsigned;
Show 27 methods
// Required methods
fn port_direction(&self, port: impl Into<PortIndex>) -> Option<Direction>;
fn port_node(&self, port: impl Into<PortIndex>) -> Option<NodeIndex>;
fn port_offset(
&self,
port: impl Into<PortIndex>,
) -> Option<PortOffset<Self::PortOffsetBase>>;
fn port_index(
&self,
node: NodeIndex,
offset: PortOffset<Self::PortOffsetBase>,
) -> Option<PortIndex>;
fn ports(
&self,
node: NodeIndex,
direction: Direction,
) -> impl Iterator<Item = PortIndex> + Clone;
fn all_ports(
&self,
node: NodeIndex,
) -> impl Iterator<Item = PortIndex> + Clone;
fn input(&self, node: NodeIndex, offset: usize) -> Option<PortIndex>;
fn output(&self, node: NodeIndex, offset: usize) -> Option<PortIndex>;
fn num_ports(&self, node: NodeIndex, direction: Direction) -> usize;
fn port_offsets(
&self,
node: NodeIndex,
direction: Direction,
) -> impl Iterator<Item = PortOffset<Self::PortOffsetBase>> + Clone;
fn all_port_offsets(
&self,
node: NodeIndex,
) -> impl Iterator<Item = PortOffset<Self::PortOffsetBase>> + Clone;
fn contains_node(&self, node: NodeIndex) -> bool;
fn contains_port(&self, port: PortIndex) -> bool;
fn is_empty(&self) -> bool;
fn node_count(&self) -> usize;
fn port_count(&self) -> usize;
fn nodes_iter(&self) -> impl Iterator<Item = NodeIndex> + Clone;
fn ports_iter(&self) -> impl Iterator<Item = PortIndex> + Clone;
fn node_capacity(&self) -> usize;
fn port_capacity(&self) -> usize;
fn node_port_capacity(&self, node: NodeIndex) -> usize;
// Provided methods
fn inputs(&self, node: NodeIndex) -> impl Iterator<Item = PortIndex> + Clone { ... }
fn outputs(
&self,
node: NodeIndex,
) -> impl Iterator<Item = PortIndex> + Clone { ... }
fn num_inputs(&self, node: NodeIndex) -> usize { ... }
fn num_outputs(&self, node: NodeIndex) -> usize { ... }
fn input_offsets(
&self,
node: NodeIndex,
) -> impl Iterator<Item = PortOffset<Self::PortOffsetBase>> + Clone { ... }
fn output_offsets(
&self,
node: NodeIndex,
) -> impl Iterator<Item = PortOffset<Self::PortOffsetBase>> + Clone { ... }
}Expand description
Core capabilities for querying a graph containing nodes and ports.
Required Associated Types§
Sourcetype PortOffsetBase: Unsigned
type PortOffsetBase: Unsigned
The base unsigned integer type for port offsets.
Required Methods§
Sourcefn port_direction(&self, port: impl Into<PortIndex>) -> Option<Direction>
fn port_direction(&self, port: impl Into<PortIndex>) -> Option<Direction>
Returns the direction of the port.
Sourcefn port_node(&self, port: impl Into<PortIndex>) -> Option<NodeIndex>
fn port_node(&self, port: impl Into<PortIndex>) -> Option<NodeIndex>
Returns the node that the port belongs to.
Sourcefn port_offset(
&self,
port: impl Into<PortIndex>,
) -> Option<PortOffset<Self::PortOffsetBase>>
fn port_offset( &self, port: impl Into<PortIndex>, ) -> Option<PortOffset<Self::PortOffsetBase>>
Returns the index of a port within its node’s port list.
Sourcefn port_index(
&self,
node: NodeIndex,
offset: PortOffset<Self::PortOffsetBase>,
) -> Option<PortIndex>
fn port_index( &self, node: NodeIndex, offset: PortOffset<Self::PortOffsetBase>, ) -> Option<PortIndex>
Returns the port index for a given node and offset.
Sourcefn ports(
&self,
node: NodeIndex,
direction: Direction,
) -> impl Iterator<Item = PortIndex> + Clone
fn ports( &self, node: NodeIndex, direction: Direction, ) -> impl Iterator<Item = PortIndex> + Clone
Iterates over all the ports of the node in the given direction.
Sourcefn all_ports(&self, node: NodeIndex) -> impl Iterator<Item = PortIndex> + Clone
fn all_ports(&self, node: NodeIndex) -> impl Iterator<Item = PortIndex> + Clone
Iterates over the input and output ports of the node in sequence.
Sourcefn input(&self, node: NodeIndex, offset: usize) -> Option<PortIndex>
fn input(&self, node: NodeIndex, offset: usize) -> Option<PortIndex>
Returns the input port at the given offset in the node.
Shorthand for PortView::port_index.
Sourcefn output(&self, node: NodeIndex, offset: usize) -> Option<PortIndex>
fn output(&self, node: NodeIndex, offset: usize) -> Option<PortIndex>
Returns the output port at the given offset in the node.
Shorthand for PortView::port_index.
Sourcefn num_ports(&self, node: NodeIndex, direction: Direction) -> usize
fn num_ports(&self, node: NodeIndex, direction: Direction) -> usize
Returns the number of ports of the node in the given direction.
Sourcefn port_offsets(
&self,
node: NodeIndex,
direction: Direction,
) -> impl Iterator<Item = PortOffset<Self::PortOffsetBase>> + Clone
fn port_offsets( &self, node: NodeIndex, direction: Direction, ) -> impl Iterator<Item = PortOffset<Self::PortOffsetBase>> + Clone
Iterates over all the port offsets of the node in the given direction.
§Example
let mut graph: PortGraph = PortGraph::new();
let node = graph.add_node(0, 2);
assert!(graph.links(node, Direction::Incoming).eq([]));
assert!(graph.port_offsets(node, Direction::Outgoing).eq([PortOffset::new_outgoing(0), PortOffset::new_outgoing(1)]));Sourcefn all_port_offsets(
&self,
node: NodeIndex,
) -> impl Iterator<Item = PortOffset<Self::PortOffsetBase>> + Clone
fn all_port_offsets( &self, node: NodeIndex, ) -> impl Iterator<Item = PortOffset<Self::PortOffsetBase>> + Clone
Iterates over the input and output port offsets of the node in sequence.
Sourcefn contains_node(&self, node: NodeIndex) -> bool
fn contains_node(&self, node: NodeIndex) -> bool
Returns whether the port graph contains the node.
Sourcefn contains_port(&self, port: PortIndex) -> bool
fn contains_port(&self, port: PortIndex) -> bool
Returns whether the port graph contains the port.
Sourcefn node_count(&self) -> usize
fn node_count(&self) -> usize
Returns the number of nodes in the port graph.
Sourcefn port_count(&self) -> usize
fn port_count(&self) -> usize
Returns the number of ports in the port graph.
Sourcefn nodes_iter(&self) -> impl Iterator<Item = NodeIndex> + Clone
fn nodes_iter(&self) -> impl Iterator<Item = NodeIndex> + Clone
Iterates over the nodes in the port graph.
Sourcefn ports_iter(&self) -> impl Iterator<Item = PortIndex> + Clone
fn ports_iter(&self) -> impl Iterator<Item = PortIndex> + Clone
Iterates over the ports in the port graph.
Sourcefn node_capacity(&self) -> usize
fn node_capacity(&self) -> usize
Returns the capacity of the underlying buffer for nodes.
Sourcefn port_capacity(&self) -> usize
fn port_capacity(&self) -> usize
Returns the capacity of the underlying buffer for ports.
Sourcefn node_port_capacity(&self, node: NodeIndex) -> usize
fn node_port_capacity(&self, node: NodeIndex) -> usize
Returns the allocated port capacity for a specific node.
Changes to the number of ports of the node will not reallocate until the number of ports exceeds this capacity.
Provided Methods§
Sourcefn inputs(&self, node: NodeIndex) -> impl Iterator<Item = PortIndex> + Clone
fn inputs(&self, node: NodeIndex) -> impl Iterator<Item = PortIndex> + Clone
Iterates over all the input ports of the node.
Shorthand for PortView::ports(Direction::Incoming).
Sourcefn outputs(&self, node: NodeIndex) -> impl Iterator<Item = PortIndex> + Clone
fn outputs(&self, node: NodeIndex) -> impl Iterator<Item = PortIndex> + Clone
Iterates over all the output ports of the node.
Shorthand for PortView::ports(Direction::Outgoing).
Sourcefn num_inputs(&self, node: NodeIndex) -> usize
fn num_inputs(&self, node: NodeIndex) -> usize
Returns the number of input ports of the node.
Shorthand for PortView::num_ports(Direction::Incoming)..
Sourcefn num_outputs(&self, node: NodeIndex) -> usize
fn num_outputs(&self, node: NodeIndex) -> usize
Returns the number of output ports of the node.
Shorthand for PortView::num_ports(Direction::Outgoing)..
Sourcefn input_offsets(
&self,
node: NodeIndex,
) -> impl Iterator<Item = PortOffset<Self::PortOffsetBase>> + Clone
fn input_offsets( &self, node: NodeIndex, ) -> impl Iterator<Item = PortOffset<Self::PortOffsetBase>> + Clone
Iterates over all the input port offsets of the node.
Shorthand for PortView::port_offsets(Direction::Incoming).
Sourcefn output_offsets(
&self,
node: NodeIndex,
) -> impl Iterator<Item = PortOffset<Self::PortOffsetBase>> + Clone
fn output_offsets( &self, node: NodeIndex, ) -> impl Iterator<Item = PortOffset<Self::PortOffsetBase>> + Clone
Iterates over all the output port offsets of the node.
Shorthand for PortView::port_offsets(Direction::Outgoing).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<G: PortView> PortView for &G
impl<G: PortView> PortView for &G
type PortOffsetBase = <G as PortView>::PortOffsetBase
fn port_direction(&self, port: impl Into<PortIndex>) -> Option<Direction>
fn port_node(&self, port: impl Into<PortIndex>) -> Option<NodeIndex>
fn port_offset( &self, port: impl Into<PortIndex>, ) -> Option<PortOffset<Self::PortOffsetBase>>
fn port_index( &self, node: NodeIndex, offset: PortOffset<Self::PortOffsetBase>, ) -> Option<PortIndex>
fn ports( &self, node: NodeIndex, direction: Direction, ) -> impl Iterator<Item = PortIndex> + Clone
fn all_ports(&self, node: NodeIndex) -> impl Iterator<Item = PortIndex> + Clone
fn input(&self, node: NodeIndex, offset: usize) -> Option<PortIndex>
fn output(&self, node: NodeIndex, offset: usize) -> Option<PortIndex>
fn num_ports(&self, node: NodeIndex, direction: Direction) -> usize
fn port_offsets( &self, node: NodeIndex, direction: Direction, ) -> impl Iterator<Item = PortOffset<Self::PortOffsetBase>> + Clone
fn all_port_offsets( &self, node: NodeIndex, ) -> impl Iterator<Item = PortOffset<Self::PortOffsetBase>> + Clone
fn contains_node(&self, node: NodeIndex) -> bool
fn contains_port(&self, port: PortIndex) -> bool
fn is_empty(&self) -> bool
fn node_count(&self) -> usize
fn port_count(&self) -> usize
fn nodes_iter(&self) -> impl Iterator<Item = NodeIndex> + Clone
fn ports_iter(&self) -> impl Iterator<Item = PortIndex> + Clone
fn node_capacity(&self) -> usize
fn port_capacity(&self) -> usize
fn node_port_capacity(&self, node: NodeIndex) -> usize
Source§impl<G: PortView> PortView for &mut G
impl<G: PortView> PortView for &mut G
type PortOffsetBase = <G as PortView>::PortOffsetBase
fn port_direction(&self, port: impl Into<PortIndex>) -> Option<Direction>
fn port_node(&self, port: impl Into<PortIndex>) -> Option<NodeIndex>
fn port_offset( &self, port: impl Into<PortIndex>, ) -> Option<PortOffset<Self::PortOffsetBase>>
fn port_index( &self, node: NodeIndex, offset: PortOffset<Self::PortOffsetBase>, ) -> Option<PortIndex>
fn ports( &self, node: NodeIndex, direction: Direction, ) -> impl Iterator<Item = PortIndex> + Clone
fn all_ports(&self, node: NodeIndex) -> impl Iterator<Item = PortIndex> + Clone
fn input(&self, node: NodeIndex, offset: usize) -> Option<PortIndex>
fn output(&self, node: NodeIndex, offset: usize) -> Option<PortIndex>
fn num_ports(&self, node: NodeIndex, direction: Direction) -> usize
fn port_offsets( &self, node: NodeIndex, direction: Direction, ) -> impl Iterator<Item = PortOffset<Self::PortOffsetBase>> + Clone
fn all_port_offsets( &self, node: NodeIndex, ) -> impl Iterator<Item = PortOffset<Self::PortOffsetBase>> + Clone
fn contains_node(&self, node: NodeIndex) -> bool
fn contains_port(&self, port: PortIndex) -> bool
fn is_empty(&self) -> bool
fn node_count(&self) -> usize
fn port_count(&self) -> usize
fn nodes_iter(&self) -> impl Iterator<Item = NodeIndex> + Clone
fn ports_iter(&self) -> impl Iterator<Item = PortIndex> + Clone
fn node_capacity(&self) -> usize
fn port_capacity(&self) -> usize
fn node_port_capacity(&self, node: NodeIndex) -> usize
Implementors§
Source§impl<G> PortView for FlatRegion<'_, G>
impl<G> PortView for FlatRegion<'_, G>
type PortOffsetBase = <G as PortView>::PortOffsetBase
Source§impl<G> PortView for Region<'_, G>
impl<G> PortView for Region<'_, G>
type PortOffsetBase = <G as PortView>::PortOffsetBase
Source§impl<G, Ctx> PortView for FilteredGraph<G, NodeFilter<Ctx>, LinkFilter<Ctx>, Ctx>
impl<G, Ctx> PortView for FilteredGraph<G, NodeFilter<Ctx>, LinkFilter<Ctx>, Ctx>
type PortOffsetBase = <G as PortView>::PortOffsetBase
Source§impl<G: PortView> PortView for DynamicTopoConvexChecker<G>
Implement PortView for DynamicTopoConvexChecker
impl<G: PortView> PortView for DynamicTopoConvexChecker<G>
Implement PortView for DynamicTopoConvexChecker