pub struct Edge {Show 14 fields
pub from: String,
pub to: String,
pub from_subgraph: Option<String>,
pub to_subgraph: Option<String>,
pub label: Option<String>,
pub stroke: Stroke,
pub style: EdgeStyle,
pub arrow_start: Arrow,
pub arrow_end: Arrow,
pub head_label: Option<String>,
pub tail_label: Option<String>,
pub minlen: i32,
pub index: usize,
pub wrapped_label_lines: Option<Vec<String>>,
}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.
style: EdgeStyleRenderer-visible edge style overrides from Mermaid linkStyle.
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().
wrapped_label_lines: Option<Vec<String>>Pre-engine wrap artifact: the result of running graph::measure::wrap_lines
against label (post-normalize_br_tags) using the render’s configured
ProportionalTextMetrics and LayoutConfig.edge_label_max_width.
Populated by graph::label_wrap::prepare_wrapped_labels in the runtime
wrap pass. None means “no wrap computed” — callers fall back to
single-line label in that case.
This lives on diagram::Edge rather than LayoutEdge so the wrap
decision can be shared by engine sizing, renderers, and MMDS replay.
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_style(self, style: EdgeStyle) -> Self
pub fn with_style(self, style: EdgeStyle) -> Self
Set renderer-visible style overrides.
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.