Skip to main content

Module doc_site

Module doc_site 

Source
Expand description

Landing page and OpenAPI (Redoc) assets for cargo xtask doc.

cargo doc leaves target/doc/ as a bare pile of per-crate directories, which is exactly what GitHub Pages would serve as the site root. This module gives the doc root a real entry point:

  • index.html — a small landing page (inline CSS, no external assets) listing every workspace crate with its description from cargo metadata, each linking into that crate’s rustdoc.
  • openapi.json — a copy of the checked-in REST contract (docs/generated/openapi.json) so the doc site is self-contained.
  • openapi.html — renders that contract with the Redoc standalone bundle (the one external asset, loaded from the Redoc CDN at view time).

.github/workflows/docs.yml builds docs through cargo xtask doc --strict, so what Pages deploys is exactly what this module writes — the workflow no longer carries its own inline HTML step.

Structs§

CrateEntry 🔒
One workspace crate as rendered on the landing page.

Constants§

OPENAPI_SOURCE 🔒
Relative path (from the repo root) of the generated OpenAPI contract that gets copied beside the landing page. Kept current by cargo xtask check-openapi, so the doc site always renders the same contract CI gates.
REDOC_HTML 🔒
Static Redoc host page. spec-url is relative so the page works both on GitHub Pages and from a local target/doc/ checkout; the standalone bundle comes from the Redoc CDN (the doc site’s only external asset).

Functions§

documented_target_name 🔒
Pick the target cargo doc documents for a package: the lib-like target when present (lib/rlib/dylib/cdylib/staticlib/proc-macro), otherwise the first bin. When a package has both a lib and a same-named bin (apps/soma), rustdoc documents the lib, so lib-first matches the output on disk.
emit 🔒
Write the landing page and OpenAPI assets into doc_root (normally target/doc/).
escape_html 🔒
Minimal HTML escaping for text interpolated into the landing page. Descriptions come from our own Cargo manifests, but escaping keeps the generator correct no matter what a future manifest says.
landing_html 🔒
Render the landing page. Inline CSS only; the sole external reference on the whole doc site is the Redoc bundle inside openapi.html.
workspace_crates 🔒
Enumerate workspace crates via cargo metadata --no-deps.