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            "integer-partitions",
33            "rank-unrank",
34        ],
35        data_forms: &[
36            "bit-vector",
37            "subset",
38            "combination",
39            "permutation",
40            "partition",
41        ],
42        limits: "Counts are exact BigUint. Bitmask iterators cap cardinality at \
43                 127; explosive enumerations require explicit bounds from the \
44                 caller via take/limit.",
45    }];
46    CARDS
47}
48
49#[cfg(test)]
50mod tests {
51    use super::*;
52
53    #[test]
54    fn card_present() {
55        assert_eq!(combinatorics_cards()[0].key, "discrete/combinatorics");
56    }
57}