tididi_cnf/
guide.rs

1//! The [worked examples](examples) put the crate to work on applications, from
2//! counting a product's configurations to the distinct outputs of a circuit.
3//! [Using diagrams from the compiler](library_integration) runs a bounded
4//! compile from Rust and queries its diagram. The [architecture
5//! reference](architecture) maps the source for contributors. The binary, the
6//! input format and the run record are in the
7//! [command-line guide](https://github.com/Tractables/tididi-cnf/blob/main/docs/getting-started.md).
8
9// Keep the index, sidebar and module declarations in one reading order.
10macro_rules! walkthroughs {
11    ($($name:ident => ($title:literal, $description:literal)),+ $(,)?) => {
12        macro_rules! navigation {
13            () => {
14                concat!(
15                    "<script>(() => { const examples = [",
16                    $("[\"", stringify!($name), "\",\"", $title, "\"],",)+
17                    "];", include_str!("../docs/example-navigation.js"), "})();</script>"
18                )
19            };
20        }
21
22        #[doc = concat!(
23            "Worked examples, from counting to compiling on a vtree of your choice.\n\n",
24            $("1. [", $title, "](examples::", stringify!($name), ") — ", $description, "\n",)+
25        )]
26        #[doc = navigation!()]
27        pub mod examples {
28            $(
29                #[doc = include_str!(concat!("../docs/examples/", stringify!($name), ".md"))]
30                // Only excerpts checked against runnable programs suppress the badge.
31                #[doc = "<style>.example-wrap.ignore:has(> pre.tested-example) > .tooltip { display: none; }</style>"]
32                #[doc = navigation!()]
33                pub mod $name {}
34            )+
35        }
36    };
37}
38
39walkthroughs! {
40    catalog => ("Product configurations", "Count the configurations rules allow, project them, and keep the circuit."),
41    reliability => ("Network reliability", "Weigh assignments by probabilities to find how likely two sites stay connected."),
42    circuits => ("Distinct outputs", "Encode a multiplier as clauses and count the products it outputs."),
43    vtree_choice => ("Choosing a vtree", "Compile one formula on several vtrees and compare the circuits."),
44}
45
46#[doc = include_str!("../docs/library-integration.md")]
47pub mod library_integration {}
48
49#[doc = include_str!("../docs/architecture.md")]
50pub mod architecture {}