wolf_graph_mermaid/
edge_attributes.rs1use crate::{details::format_custom_style, Arrowhead, Color, EdgeStyle};
2
3#[derive(Debug, Clone, PartialEq)]
4pub struct EdgeAttributes {
5 pub label: Option<String>,
6 pub length: Option<usize>,
7 pub style: Option<EdgeStyle>,
8 pub tail: Option<Arrowhead>,
9 pub head: Option<Arrowhead>,
10 pub stroke_color: Option<Color>,
11 pub stroke_width: Option<f64>,
12 pub dash_array: Option<Vec<f64>>,
13}
14
15impl EdgeAttributes {
16 #[allow(clippy::too_many_arguments)]
17 pub fn new(
18 label: Option<String>,
19 length: Option<usize>,
20 style: Option<EdgeStyle>,
21 tail: Option<Arrowhead>,
22 head: Option<Arrowhead>,
23 stroke_color: Option<Color>,
24 stroke_width: Option<f64>,
25 dash_array: Option<Vec<f64>>,
26 ) -> Self {
27 Self {
28 label,
29 length,
30 style,
31 tail,
32 head,
33 stroke_color,
34 stroke_width,
35 dash_array,
36 }
37 }
38
39 pub fn custom_style(&self) -> Option<String> {
40 format_custom_style(
41 None,
42 self.stroke_color.as_ref(),
43 self.stroke_width,
44 self.dash_array.as_deref(),
45 )
46 }
47}