Skip to main content

sim_lib_discrete_graph/
cards.rs

1//! Browse/help card content for the graph family, as kernel-free static data.
2//!
3//! These descriptors are the single source of truth for the graph Cards. The
4//! facade crate registers them into the runtime; keeping them here as plain data
5//! preserves the boundary (this crate never depends on the kernel).
6
7/// A browse/help card descriptor for one discrete family or operation group.
8#[derive(Debug, Clone, Copy, PartialEq, Eq)]
9pub struct CardSpec {
10    /// Stable card key (for example `discrete/graph`).
11    pub key: &'static str,
12    /// One-line summary.
13    pub summary: &'static str,
14    /// Operation names exposed by this family.
15    pub operations: &'static [&'static str],
16    /// Data forms / value types this family deals in.
17    pub data_forms: &'static [&'static str],
18    /// Known limits and capability needs, in prose.
19    pub limits: &'static str,
20}
21
22/// The graph family cards available so far.
23pub fn graph_cards() -> &'static [CardSpec] {
24    const CARDS: &[CardSpec] = &[CardSpec {
25        key: "discrete/graph",
26        summary: "Weighted graphs, certified paths, and minimum-cost assignment.",
27        operations: &[
28            "bfs",
29            "dfs",
30            "connected-components",
31            "weakly-connected-components",
32            "strongly-connected-components",
33            "min-cost-assignment",
34            "verify-assignment",
35        ],
36        data_forms: &["graph", "edge", "cost-matrix", "assignment-certificate"],
37        limits: "Node identity is index-based; multiedges and self-loops are \
38                 representable. Connectivity validates endpoints and fails closed \
39                 on out-of-range nodes. Assignment uses exact checked additive costs.",
40    }];
41    CARDS
42}
43
44#[cfg(test)]
45mod tests {
46    use super::*;
47
48    #[test]
49    fn graph_card_is_present_and_ascii() {
50        let cards = graph_cards();
51        assert_eq!(cards.len(), 1);
52        assert_eq!(cards[0].key, "discrete/graph");
53        assert!(cards[0].summary.is_ascii());
54    }
55}