wolf-graph-mermaid 0.1.0

Adds support for generating Mermaid diagrams from wolf-graph graphs.
Documentation
use crate::{details::format_custom_style, Arrowhead, Color, EdgeStyle};

#[derive(Debug, Clone, PartialEq)]
pub struct EdgeAttributes {
    pub label: Option<String>,
    pub length: Option<usize>,
    pub style: Option<EdgeStyle>,
    pub tail: Option<Arrowhead>,
    pub head: Option<Arrowhead>,
    pub stroke_color: Option<Color>,
    pub stroke_width: Option<f64>,
    pub dash_array: Option<Vec<f64>>,
}

impl EdgeAttributes {
    #[allow(clippy::too_many_arguments)]
    pub fn new(
        label: Option<String>,
        length: Option<usize>,
        style: Option<EdgeStyle>,
        tail: Option<Arrowhead>,
        head: Option<Arrowhead>,
        stroke_color: Option<Color>,
        stroke_width: Option<f64>,
        dash_array: Option<Vec<f64>>,
    ) -> Self {
        Self {
            label,
            length,
            style,
            tail,
            head,
            stroke_color,
            stroke_width,
            dash_array,
        }
    }

    pub fn custom_style(&self) -> Option<String> {
        format_custom_style(
            None,
            self.stroke_color.as_ref(),
            self.stroke_width,
            self.dash_array.as_deref(),
        )
    }
}