pub struct Edge {
pub id: EdgeId,
pub source: NodeId,
pub target: NodeId,
pub kind: EdgeKind,
pub label: Option<String>,
}Expand description
A directed edge connecting two nodes.
Fields§
§id: EdgeIdUnique id within the graph; cosmetic — excluded from the architecture fingerprint.
source: NodeIdThe node this edge leaves.
target: NodeIdThe node this edge enters.
kind: EdgeKindWhether the edge carries data or control.
label: Option<String>Optional label; on an edge leaving a Branch node it names the arm.
Implementations§
Source§impl Edge
impl Edge
Sourcepub fn data(
id: impl Into<String>,
source: impl Into<String>,
target: impl Into<String>,
) -> Self
pub fn data( id: impl Into<String>, source: impl Into<String>, target: impl Into<String>, ) -> Self
Create a data edge: source’s output becomes an input of target.
This is what Graph::connect builds, and what input resolution
follows — a node’s inputs are the outputs of its data predecessors,
not “whatever ran last”.
Sourcepub fn control(
id: impl Into<String>,
source: impl Into<String>,
target: impl Into<String>,
) -> Self
pub fn control( id: impl Into<String>, source: impl Into<String>, target: impl Into<String>, ) -> Self
Create a control edge: source decides whether target runs, but
hands it no data.
Control edges are how the compiler claims loop bodies and branch arms (by dominance); a branch passes its input to the chosen arm, not the selector’s output.
Sourcepub fn with_label(self, label: impl Into<String>) -> Self
pub fn with_label(self, label: impl Into<String>) -> Self
Attach a label. On an edge leaving a Branch node the label names the
arm; the branch condition’s value is matched against it.