Skip to content

docs: add doc(cfg) annotations for feature-gated APIs - #109

Merged
iainmcgin merged 1 commit into
connectrpc:mainfrom
Yong-yuan-X:fix/docsrs-doc-cfg-102
May 18, 2026
Merged

iainmcgin merged 1 commit into
connectrpc:mainfrom
Yong-yuan-X:fix/docsrs-doc-cfg-102

Conversation

@Yong-yuan-X

Copy link
Copy Markdown
Contributor

Summary

  • Add docs.rs doc(cfg(...)) annotations to feature-gated public API items.
  • Cover client, client TLS, server, server TLS, compression, streaming, axum, and TLS re-export surfaces.
  • Preserve existing #[cfg(...)] gates and avoid generated files.

Fixes #102.

Verification

  • rustfmt --edition 2024 --check connectrpc/src/lib.rs connectrpc/src/compression.rs connectrpc/src/client/mod.rs connectrpc/src/client/http2.rs connectrpc/src/response.rs connectrpc/src/server.rs connectrpc/src/service.rs
  • cargo check -p connectrpc --all-features --all-targets
  • cargo doc -p connectrpc --all-features --no-deps

Workspace commands attempted but blocked locally because protoc is not installed/on PATH:

  • cargo check --workspace --all-features --all-targets
  • cargo doc --workspace --all-features --no-deps

@github-actions

github-actions Bot commented May 17, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@Yong-yuan-X

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request May 17, 2026

@iainmcgin iainmcgin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the contribution!

@iainmcgin
iainmcgin enabled auto-merge (squash) May 18, 2026 18:27
Add `#[cfg_attr(docsrs, doc(cfg(...)))]` to feature-gated public API
items across `client`, `client-tls`, `server`, `server-tls`, `gzip`,
`zstd`, `streaming`, and `axum` surfaces so docs.rs renders the
"Available on crate feature ... only" badges.

The convention is to annotate the minimal cfg expression after Cargo
feature implications collapse (e.g. `client-tls` rather than
`all(client, client-tls)` since `client-tls` enables `client`), and use
`all(...)` only when neither feature implies the other (e.g. the
`StreamingCompressionProvider` impls require both `gzip`/`zstd` and
`streaming`).

Fixes connectrpc#102.

Co-authored-by: Ruifeng Xue <129142497+Yong-yuan-X@users.noreply.github.com>
@iainmcgin
iainmcgin force-pushed the fix/docsrs-doc-cfg-102 branch from eedba89 to b494843 Compare May 18, 2026 19:48
@iainmcgin
iainmcgin disabled auto-merge May 18, 2026 19:50
@iainmcgin
iainmcgin enabled auto-merge (squash) May 18, 2026 19:50
@iainmcgin
iainmcgin merged commit 13ffe31 into connectrpc:main May 18, 2026
12 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent cfg_attr(docsrs, doc(cfg(...))) annotation across feature-gated public API

2 participants