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 itsdescriptionfromcargo 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§
- Crate
Entry 🔒 - 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-urlis relative so the page works both on GitHub Pages and from a localtarget/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 docdocuments 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(normallytarget/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.