Skip to content

docs: improve API documentation - #320

Open
Tim-Zhang wants to merge 1 commit into
masterfrom
docs/improve-api-documentation
Open

docs: improve API documentation#320
Tim-Zhang wants to merge 1 commit into
masterfrom
docs/improve-api-documentation

Conversation

@Tim-Zhang

Copy link
Copy Markdown
Member

Summary

  • redesign the crate landing page around getting started, runtime selection, and an API tour
  • document public APIs across the sync, async, streaming, transport, compiler, and codegen crates
  • add rustdoc lint guards and compiled documentation examples

Why

The existing API documentation was sparse and did not clearly explain the code generation workflow, runtime choices, feature flags, transport support, or failure semantics. This update makes docs.rs useful as both an onboarding guide and an API reference.

This is a documentation-only change and does not alter runtime behavior.

Validation

  • RUSTDOCFLAGS='-D missing_docs -D rustdoc::broken_intra_doc_links' cargo doc --workspace --all-features --no-deps
  • default-feature and async-only rustdoc builds with -D warnings
  • cargo test --workspace --all-features --doc
  • make check-all
  • git diff --check

Document public APIs and improve the crate landing page.

Signed-off-by: Tim Zhang <tim@hyper.sh>
@Tim-Zhang
Tim-Zhang marked this pull request as ready for review August 6, 2026 13:05
@Tim-Zhang
Tim-Zhang requested review from teawater and wllenyj and a lite review from Copilot August 6, 2026 13:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A stray unindented /// in src/asynchronous/shutdown.rs is likely to trigger warnings/errors under -D warnings rustdoc builds.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

This PR significantly expands and modernizes the rustdoc surface across the workspace (crate landing pages, public APIs, and examples) and adds rustdoc lint guards to keep documentation quality high going forward.

Changes:

  • Rewrites crate/module-level docs to focus on onboarding (getting started, runtime selection, transport addresses) and API “tours”.
  • Adds/updates rustdoc for many public types and methods across sync/async runtimes, streaming, transports, framing, and codegen/compiler crates.
  • Enables rustdoc linting via #![warn(missing_docs)] and #![warn(rustdoc::broken_intra_doc_links)], and adds a dev-dependency to support doc tests/examples.
File summaries
File Description
ttrpc-codegen/src/lib.rs Adds crate-level docs, examples, and missing-docs/broken-link lint warnings for codegen APIs.
src/sync/utils.rs Documents sync request context and generated dispatch traits.
src/sync/server.rs Expands sync Server docs with examples, error/panic semantics, and configuration details.
src/sync/mod.rs Adds module overview docs for the sync runtime.
src/sync/client.rs Documents sync Client behavior, ownership, and request failure modes.
src/proto.rs Documents framing constants, headers, frame types, and codec traits.
src/lib.rs Redesigns crate landing page (getting started, runtime choice, transports, security) and enables rustdoc lints.
src/error.rs Improves error type and helper function documentation.
src/context.rs Documents request context semantics, metadata behavior, and conversion helpers.
src/asynchronous/utils.rs Documents async handler traits and async request context.
src/asynchronous/transport/windows.rs Documents named-pipe bind/connect helpers.
src/asynchronous/transport/vsock.rs Documents vsock bind/connect helpers and FD safety/ownership.
src/asynchronous/transport/unix.rs Documents unix bind/connect helpers and FD safety/ownership.
src/asynchronous/transport/tcp.rs Documents async TCP transport helpers (Unix-only via module cfg).
src/asynchronous/transport/mod.rs Adds module overview and documents transport extension points and address binding/connection APIs.
src/asynchronous/stream.rs Documents streaming handle types, split semantics, and error cases.
src/asynchronous/shutdown.rs Adds module overview and documents shutdown coordination primitives.
src/asynchronous/server.rs Documents async Server lifecycle, listener ownership, registration behavior, and failure modes.
src/asynchronous/mod.rs Adds async runtime module overview and clarifies runtime requirements.
src/asynchronous/client.rs Documents async Client behavior, runtime requirements, and request/streaming APIs.
compiler/src/prost_codegen.rs Adds module-level docs and documents failure semantics for legacy protoc/prost pipeline.
compiler/src/lib.rs Adds crate-level docs plus rustdoc lint warnings; improves public API field docs.
compiler/src/codegen.rs Documents key public generator entry points and their error/panic semantics.
compiler/src/bin/ttrpc_rust_plugin.rs Documents the protoc plugin binary entry point.
Cargo.toml Adds ttrpc-codegen as a dev-dependency for workspace doc tests/examples.
Review details
  • Files reviewed: 25/25 changed files
  • Comments generated: 2
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment thread src/context.rs
Comment on lines +81 to +83
/// Replaces all metadata values for `key`.
///
/// Passing an empty vector removes the key. Non-empty keys are normalized to lowercase.
Comment on lines +141 to +143
/// Requests shutdown and wakes all current waiters.
///
/// Calling this method more than once has no additional effect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants