pub struct Edge {
pub from: String,
pub to: String,
pub from_subgraph: Option<String>,
pub to_subgraph: Option<String>,
pub label: Option<String>,
pub stroke: Stroke,
pub arrow_start: Arrow,
pub arrow_end: Arrow,
pub head_label: Option<String>,
pub tail_label: Option<String>,
pub minlen: i32,
pub index: usize,
}Expand description
An edge connecting two nodes.
Fields§
§from: StringSource node ID.
to: StringTarget node ID.
from_subgraph: Option<String>Original subgraph ID for the source endpoint, if the edge targeted a subgraph.
to_subgraph: Option<String>Original subgraph ID for the target endpoint, if the edge targeted a subgraph.
label: Option<String>Optional label on the edge.
stroke: StrokeLine style.
arrow_start: ArrowArrow head at the start (source-side) of the edge.
arrow_end: ArrowArrow head at the end (target-side) of the edge.
head_label: Option<String>Label near the target endpoint (head).
tail_label: Option<String>Label near the source endpoint (tail).
minlen: i32Minimum rank separation between source and target. Default 1.
index: usizeIndex of this edge in the diagram’s edge list.
Assigned automatically by Diagram::add_edge().
Implementations§
Source§impl Edge
impl Edge
Sourcepub fn new(from: impl Into<String>, to: impl Into<String>) -> Self
pub fn new(from: impl Into<String>, to: impl Into<String>) -> Self
Create a new edge with default style (solid line with arrow).
Sourcepub fn with_label(self, label: impl Into<String>) -> Self
pub fn with_label(self, label: impl Into<String>) -> Self
Set the label for this edge.
Sourcepub fn with_stroke(self, stroke: Stroke) -> Self
pub fn with_stroke(self, stroke: Stroke) -> Self
Set the stroke style.
Sourcepub fn with_arrow(self, arrow: Arrow) -> Self
pub fn with_arrow(self, arrow: Arrow) -> Self
Set the arrow type for the end (target-side) of the edge.
Sourcepub fn with_arrows(self, start: Arrow, end: Arrow) -> Self
pub fn with_arrows(self, start: Arrow, end: Arrow) -> Self
Set arrow types for both start and end.
Sourcepub fn with_minlen(self, minlen: i32) -> Self
pub fn with_minlen(self, minlen: i32) -> Self
Set minimum rank separation (default 1). Use 0 for same-rank placement.