Skip to content

server: with_* builder consistency + ConnectRpcService dispatch-config proxies - #105

Merged
iainmcgin merged 2 commits into
mainfrom
iainmcgin/issue-104-server-builder-consistency
May 16, 2026
Merged

iainmcgin merged 2 commits into
mainfrom
iainmcgin/issue-104-server-builder-consistency

Conversation

@iainmcgin

Copy link
Copy Markdown
Collaborator

Fixes #104.

Server is the convenience wrapper around ConnectRpcService, but until now it only exposed connection-level knobs (with_tls, tls_handshake_timeout, HTTP/1.1 keep-alive). Setting request limits or compression required discovering Server::from_service(...) and threading config through ConnectRpcService::new(...) by hand. The compiler error doesn't point at from_service.

Changes

Renames (breaking):

Before After
Server::tls_handshake_timeout(d) Server::with_tls_handshake_timeout(d)
BoundServer::tls_handshake_timeout(d) BoundServer::with_tls_handshake_timeout(d)
BoundServer::http1_keep_alive(b) BoundServer::with_http1_keep_alive(b)
axum::ServeTls::tls_handshake_timeout(d) axum::ServeTls::with_tls_handshake_timeout(d)

Migration: prefix the call with with_. with_tls(...) and with_graceful_shutdown(...) are unchanged (already with_*). ServeTls is included because it has the same with_graceful_shutdown / bare-name tls_handshake_timeout split as Server; renaming all three at once keeps the crate consistent.

New proxies (additive): Server::with_limits, Server::with_compression, Server::with_compression_policy delegating to the same-named ConnectRpcService builders.

BoundServer doesn't get the dispatch proxies because it doesn't hold a ConnectRpcService — it takes one at serve() time. Server gets them because it constructs the service in new().

Sibling PRs

#103 adds Server::with_deadline_policy() — same Server impl block, so whichever lands second has a small merge conflict in server.rs (and CHANGELOG.md). Both are 0.5.0-bound.

Verification

task lint, task test, cargo check -p connectrpc --no-default-features, cargo check --workspace --all-features --all-targets, and RUSTDOCFLAGS="-D warnings" cargo doc -p connectrpc --all-features --no-deps all clean. Net change ~71 lines excluding tests.

@github-actions

github-actions Bot commented May 14, 2026 •

Copy link
Copy Markdown

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

@iainmcgin
iainmcgin force-pushed the iainmcgin/issue-104-server-builder-consistency branch from dbd8221 to ff37597 Compare May 14, 2026 22:51
Two related changes to Server's builder surface:

1. Rename tls_handshake_timeout -> with_tls_handshake_timeout (on
   Server, BoundServer, and axum::ServeTls) and BoundServer's
   http1_keep_alive -> with_http1_keep_alive. Server already had
   with_tls() in with_* form; the holdouts now match. Also matches the
   ConnectRpcService and ClientConfig builder convention.

2. Add Server::with_limits, Server::with_compression, and
   Server::with_compression_policy delegating to the same-named
   ConnectRpcService builders. Server already holds the inner
   ConnectRpcService; it just didn't expose these knobs, so a
   Server::new(router) user had to discover Server::from_service to set
   request limits or compression. The proxies are additive.

The renames are SemVer-breaking; landing alongside the other 0.5.0
contract-locking changes so the migration happens once. The migration is
mechanical: prefix the renamed builders with with_.
@iainmcgin
iainmcgin marked this pull request as ready for review May 15, 2026 16:22
@iainmcgin
iainmcgin force-pushed the iainmcgin/issue-104-server-builder-consistency branch from ff37597 to 2336c34 Compare May 15, 2026 16:22
@iainmcgin
iainmcgin enabled auto-merge (squash) May 15, 2026 16:22
@iainmcgin
iainmcgin requested a review from kollektiv May 15, 2026 23:58
@iainmcgin
iainmcgin merged commit 844c902 into main May 16, 2026
12 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 16, 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.

Server should proxy ConnectRpcService dispatch-config builders

2 participants