Skip to main content

sim_lib_discrete_comb/
cards.rs

1//! Browse/help card content for the combinatorics family, as static data.
2
3/// A browse/help card descriptor for the combinatorics family.
4#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5pub struct CardSpec {
6    /// Stable card key.
7    pub key: &'static str,
8    /// One-line summary.
9    pub summary: &'static str,
10    /// Operation names exposed by this family.
11    pub operations: &'static [&'static str],
12    /// Data forms / value types this family deals in.
13    pub data_forms: &'static [&'static str],
14    /// Known limits and capability needs.
15    pub limits: &'static str,
16}
17
18/// The combinatorics family cards.
19pub fn combinatorics_cards() -> &'static [CardSpec] {
20    const CARDS: &[CardSpec] = &[CardSpec {
21        key: "discrete/combinatorics",
22        summary: "Exact counts, lazy enumerators, and canonical ordinals.",
23        operations: &[
24            "factorial",
25            "binomial",
26            "stirling2",
27            "bell-number",
28            "integer-partition-count",
29            "subsets",
30            "combinations",
31            "permutations",
32            "words",
33            "integer-partitions",
34            "canonical-cycles",
35            "longest-only",
36            "rank-unrank",
37        ],
38        data_forms: &[
39            "word",
40            "bit-vector",
41            "subset",
42            "combination",
43            "permutation",
44            "cycle",
45            "partition",
46        ],
47        limits: "Counts are exact BigUint. Bitmask iterators cap cardinality at \
48                 127; explosive enumerations require explicit bounds from the \
49                 caller via take/limit.",
50    }];
51    CARDS
52}
53
54#[cfg(test)]
55mod tests {
56    use super::*;
57
58    #[test]
59    fn card_present() {
60        assert_eq!(combinatorics_cards()[0].key, "discrete/combinatorics");
61    }
62}