Assembles docs/reference/library-crates-by-layer.md into a paginated PDF book (title page, notice, about-the-author, introduction, table of contents, dependency chart, chapters by layer). Pure section/graph/template logic is tested; rendering shells pandoc/mermaid-render/typst with strict argument vectors (Gate 1.5.6) -- no shell interpreter.
| Tier | tools |
| Role | unclassified (baselined) |
| Path | crates/tools/book |
| Edition | 2021 |
| Targets | tools-book, tools_book |
| Public items | 9 across 0 modules |
| Tests | 10 |
What it is for
Pure logic for assembling docs/reference/library-crates-by-layer.md into a book: section parsing, dependency-graph extraction, heading-level promotion, and template placeholder substitution. All I/O (reading the manual, shelling to pandoc/tools-mermaid-render/typst) lives in main.rs.
Capabilities
crate root
Pure logic for assembling docs/reference/library-crates-by-layer.md into a
| Item |
|---|
fn substitute_placeholders(content : & str, year : & str, date : & str, commit : & str, crate_count : usize,) -> String |
fn typst_escape(s : & str) -> String |
CrateSection
Pure logic for assembling docs/reference/library-crates-by-layer.md into a
| Item |
|---|
pub struct CrateSection |
fn parse_manual_sections(manual : & str) -> Vec <CrateSection> |
fn build_dependency_mermaid(sections : & CrateSection) -> String |
fn build_layer_grid_typst(sections : & CrateSection) -> String |
LexiconEntry
Pure logic for assembling docs/reference/library-crates-by-layer.md into a
| Item |
|---|
pub struct LexiconEntry |
fn parse_lexicon(tsv : & str) -> Vec <LexiconEntry> |
fn render_lexicon_typst(entries : & LexiconEntry) -> String |
How to use it
No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.
Module structure
No public modules: the crate root is its whole surface.
Public surface
`crate root`
| Item | What it is |
|---|---|
pub struct CrateSection | One crate's chapter section, as parsed out of the generated manual. |
fn parse_manual_sections(manual : & str) -> Vec <CrateSection> | Parse docs/reference/library-crates-by-layer.md's body into per-crate sections, in source order (already layer-dependency-ordered, then alphabetical within a layer, by construction — see tools-gen-ai-context's render_library_crates_by_layer_md) |
fn substitute_placeholders(content : & str, year : & str, date : & str, commit : & str, crate_count : usize,) -> String | Replace {{YEAR}} / {{DATE}} / {{COMMIT}} / {{CRATE_COUNT}} placeholders |
fn build_dependency_mermaid(sections : & CrateSection) -> String | Build a Mermaid flowchart LR of dependencies between layers, not individual crates |
fn build_layer_grid_typst(sections : & CrateSection) -> String | Build the front-matter "Crates by Layer" grid: a Typst table per layer, crate names wrapped as a comma-joined list |
fn typst_escape(s : & str) -> String | Escape Typst's markup-special characters (#, *, _, , <, >, @`) in plain text that is not itself meant to be Typst markup — layer names are safe today (lowercase ascii words) but this is cheap insurance against a future layer name that isn't. |
pub struct LexiconEntry | One row of docs/reference/lexicon-policy.tsv: a flagged term, its preferred replacement(s), and the reasoning |
fn parse_lexicon(tsv : & str) -> Vec <LexiconEntry> | Parse the real lexicon TSV (term\tpreferred\tscope\tfloor\treasoning), skipping #-comment and blank lines |
fn render_lexicon_typst(entries : & LexiconEntry) -> String | Render the lexicon as a three-column Typst table (Term / Say Instead / Why) for the appendix. |
No pub use re-exports: every item above is declared in this crate.
Boundary
Depends on no other workspace tier.
Shares tier tools with 84 other crates: tools-advisory-reach, tools-archive-guard, tools-artifact-scaffold, tools-ask-ai-core, tools-ask-ais, tools-ask-gemini, tools-book-report, tools-boundary-scan, … (84 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | tools |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/tools/book |
| Vocabulary in force (lexicon) | current |
Dependencies
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
anyhow | ^1 | — | no | always |
chrono | ^0.4 | serde | no | always |
clap | ^4 | derive | no | always |
Development, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `tools-cli-conformance` | tools | no | always |
Build. None.
Depended on by. Nothing in this workspace.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR SELF["tools-book"] SELF -->|development| n_tools_cli_conformance["tools-cli-conformance"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.
Targets
| Kind | Name | Source |
|---|---|---|
| bin | tools-book | `src/main.rs` |
| lib | tools_book | `src/lib.rs` |
Error model
No public error type was detected: no public item declares a type named *Error, and no public signature returns one.
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | none detected |
| async runtime | none detected |
| database access | none detected |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | yes |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
| Variable | Read in |
|---|---|
MERMAID_MMDC | src/main.rs |
MERMAID_PUPPETEER_CONFIG | src/main.rs |
Related capabilities
No workspace crate depends on this one.
Verification
| Kind | Count |
|---|---|
| Unit tests | 10 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
crate root | 9 | 0 | 0 |
What the tests establish, by name:
build_dependency_mermaid_summarizes_cross_layer_edges_only—src/lib.rsbuild_layer_grid_typst_lists_every_crate_under_its_layer_heading—src/lib.rsparse_lexicon_skips_comments_blanks_and_malformed_rows—src/lib.rsparse_manual_sections_body_excludes_composes_line_and_separator—src/lib.rsparse_manual_sections_extracts_composes_deps—src/lib.rsparse_manual_sections_finds_every_crate_with_its_layer—src/lib.rsrender_lexicon_typst_produces_one_row_per_entry—src/lib.rssubstitute_placeholders_replaces_all_four_and_leaves_unknown_ones—src/lib.rstypst_escape_backslashes_markup_special_characters_only—src/lib.rscli_definition_conforms—src/main.rs
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 9 | 9 |
Public modules with a //! block | 0 | 0 |
pie showData
title Public items with rustdoc
"Documented" : 9
"No rustdoc detected" : 0
Metrics
| Metric | Value |
|---|---|
| Rust source files | 2 |
| Source lines | 931 |
| Code lines | 665 |
| Public API items | 9 |
| Public modules | 0 |
| Tests | 10 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 3 |
| Workspace reverse dependencies | 0 |
pie showData
title Public API by kind
"function" : 7
"struct" : 2
pie showData
title Rust source composition
"Code" : 665
"Blank or comment" : 266
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.