LinkMut

Trait LinkMut 

Source
pub trait LinkMut: LinkView + PortMut {
    // Required methods
    fn link_ports(
        &mut self,
        port_a: PortIndex,
        port_b: PortIndex,
    ) -> Result<(Self::LinkEndpoint, Self::LinkEndpoint), LinkError<Self::PortOffsetBase>>;
    fn unlink_port(&mut self, port: PortIndex) -> Option<Self::LinkEndpoint>;

    // Provided methods
    fn link_nodes(
        &mut self,
        from: NodeIndex,
        from_output: usize,
        to: NodeIndex,
        to_input: usize,
    ) -> Result<(Self::LinkEndpoint, Self::LinkEndpoint), LinkError<Self::PortOffsetBase>> { ... }
    fn link_offsets(
        &mut self,
        node_a: NodeIndex,
        offset_a: PortOffset<Self::PortOffsetBase>,
        node_b: NodeIndex,
        offset_b: PortOffset<Self::PortOffsetBase>,
    ) -> Result<(Self::LinkEndpoint, Self::LinkEndpoint), LinkError<Self::PortOffsetBase>> { ... }
    fn insert_graph(
        &mut self,
        other: &impl LinkView<PortOffsetBase = Self::PortOffsetBase>,
    ) -> Result<HashMap<NodeIndex, NodeIndex>, LinkError<Self::PortOffsetBase>> { ... }
}
Expand description

Mutating operations pertaining the adjacency of nodes in a port graph.

Required Methods§

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_a or port_b does not exist.
  • If port_a and port_b have the same direction.

Unlinks all connections to the port. If the port was connected, returns one of the ports it was connected to.

Provided Methods§

Links two nodes at an input and output port offsets.

§Errors
  • If the ports and nodes do not exist.

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.
Source

fn insert_graph( &mut self, other: &impl LinkView<PortOffsetBase = Self::PortOffsetBase>, ) -> Result<HashMap<NodeIndex, NodeIndex>, LinkError<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", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<G: LinkMut> LinkMut for &mut G

Implementors§

Source§

impl<G: LinkMut> LinkMut for DynamicTopoConvexChecker<G>

Implement LinkMut for DynamicTopoConvexChecker

Source§

impl<PO: Unsigned> LinkMut for MultiPortGraph<u32, u32, PO>

Source§

impl<PO: Unsigned> LinkMut for PortGraph<u32, u32, PO>