pub trait LinkMut: LinkView + PortMut {
// Required methods
fn link_ports(
&mut self,
port_a: PortIndex<Self::PortIndexBase>,
port_b: PortIndex<Self::PortIndexBase>,
) -> Result<(Self::LinkEndpoint, Self::LinkEndpoint), LinkError<Self::NodeIndexBase, Self::PortIndexBase, Self::PortOffsetBase>>;
fn unlink_port(
&mut self,
port: PortIndex<Self::PortIndexBase>,
) -> Option<Self::LinkEndpoint>;
// Provided methods
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_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 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>> { ... }
}Expand description
Mutating operations pertaining the adjacency of nodes in a port graph.
Required Methods§
Sourcefn link_ports(
&mut self,
port_a: PortIndex<Self::PortIndexBase>,
port_b: PortIndex<Self::PortIndexBase>,
) -> Result<(Self::LinkEndpoint, Self::LinkEndpoint), LinkError<Self::NodeIndexBase, Self::PortIndexBase, Self::PortOffsetBase>>
fn link_ports( &mut self, port_a: PortIndex<Self::PortIndexBase>, port_b: PortIndex<Self::PortIndexBase>, ) -> Result<(Self::LinkEndpoint, Self::LinkEndpoint), LinkError<Self::NodeIndexBase, Self::PortIndexBase, Self::PortOffsetBase>>
Link an output port to an input port.
§Example
let mut g: PortGraph = PortGraph::new();
let node0 = g.add_node(0, 1);
let node1 = g.add_node(1, 0);
let node0_output = g.output(node0, 0).unwrap();
let node1_input = g.input(node1, 0).unwrap();
g.link_ports(node0_output, node1_input).unwrap();
assert_eq!(g.port_link(node0_output), Some(node1_input));
assert_eq!(g.port_link(node1_input), Some(node0_output));§Errors
- If
port_aorport_bdoes not exist. - If
port_aandport_bhave the same direction.
Sourcefn unlink_port(
&mut self,
port: PortIndex<Self::PortIndexBase>,
) -> Option<Self::LinkEndpoint>
fn unlink_port( &mut self, port: PortIndex<Self::PortIndexBase>, ) -> Option<Self::LinkEndpoint>
Unlinks all connections to the port. If the port was connected,
returns one of the ports it was connected to.
Provided Methods§
Sourcefn 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>>
Sourcefn 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.
§Errors
- If the ports and nodes do not exist.
- If the ports have the same direction.
Sourcefn 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.
Returns a map from the old node indices to the new node indices.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".