Documentation Conventions
Documentation conventions keep Rust knowledge where engineers work: /// rustdoc for APIs, docs/adr/ for decisions, runbooks for on-call, and README files with ownership - not scattered wikis that drift from main.
Busca en todas las páginas de la documentación
Documentation conventions keep Rust knowledge where engineers work: /// rustdoc for APIs, docs/adr/ for decisions, runbooks for on-call, and README files with ownership - not scattered wikis that drift from main.
Quick-reference recipe card - copy-paste ready.
service-repo/
README.md # quickstart, owners, links
docs/
adr/
runbooks/
specs/
crates/*/src/lib.rs # module-level //! docsWhen to reach for this:
//! Orders domain logic - money calculations in integer cents.
//!
//! # Examples
//! ```
//! use orders_domain::total_cents;
//! assert_eq!(total_cents(100, 20).unwrap(), 120);
//! ```
pub fn total_cents(subtotal: i64, tax: i64) -> Result<i64, &'static str> {
if subtotal < 0 || tax < 0 {
return Err("negative amount");
}
Ok(subtotal + tax)
}# docs/runbooks/pool-exhaustion.md
See lesson LL-0042. Steps: check acquire p95, verify DATABASE_MAX_CONNECTIONS, rollback if deploy correlated.| Type | Location | Audience |
|---|---|---|
| rustdoc | src/ | Crate consumers |
| ADR | docs/adr/ | Future maintainers |
| Runbook | docs/runbooks/ | On-call |
| Tech spec | docs/specs/ | PM + eng delivery |
| SME site | site/rust/ | Fleet learning |
cargo test --doc).last_verified date within 90 days.Internal articles summarize patterns; repo docs are source of truth for service-specific commands and SHAs.
| Alternative | Use When | Don't Use When |
|---|---|---|
| mdBook for crate book | Large public OSS | Tiny internal lib |
| Notion for specs | PM collaboration | Sole deploy/runbook store |
| auto-doc from OpenAPI | HTTP surface | Domain logic teaching |
pub(crate) docs for complex modules; not required on every fn.
RFC folder holds proposals; accepted become ADR.
English default for fleet; product may localize user-facing only.
Publish rustdoc to internal portal on release tags.
Why not what; link ADR for non-obvious trade-offs.
Stack versions: This page was written for Rust 1.97.0 (edition 2024), Tokio 1.x, Axum 0.8, serde 1.0, sqlx 0.8, clap 4, and Polars 0.46+.
Revisado por Chris St. John·Última actualización: 19 jul 2026