source-mesh-core 1.2.1

Rust dependency graph analysis, diagrams, and cycle reports
Documentation
use colorous::Color;

use crate::color::RgbColor;
use crate::model::DependencyCount;
use crate::model::DependencyKind;

pub(in crate::export) const COLOR_EDGE_TEST: RgbColor = RgbColor::new(Color { r: 0xD9, g: 0x77, b: 0x06 });
pub(in crate::export) const CYCLE_EDGE_WIDTH: &str = "3.0";

#[must_use]
pub(in crate::export) const fn kind_name(kind: DependencyKind) -> &'static str {
    match kind {
        DependencyKind::Production => "production",
        DependencyKind::Test => "test",
    }
}

#[must_use]
pub(in crate::export) fn edge_label(kind: DependencyKind, weight: DependencyCount) -> String {
    match kind {
        DependencyKind::Production => weight.value().to_string(),
        DependencyKind::Test => format!("{}: {}", kind_name(kind), weight.value()),
    }
}