Repository navigation
server: with_* builder consistency + ConnectRpcService dispatch-config proxies - #105
Merged
Merged
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
iainmcgin
force-pushed
the
iainmcgin/issue-104-server-builder-consistency
branch
from
May 14, 2026 22:51
dbd8221 to
ff37597
Compare
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
marked this pull request as ready for review
May 15, 2026 16:22
iainmcgin
force-pushed
the
iainmcgin/issue-104-server-builder-consistency
branch
from
May 15, 2026 16:22
ff37597 to
2336c34
Compare
iainmcgin
enabled auto-merge (squash)
May 15, 2026 16:22
kollektiv
approved these changes
May 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #104.
Serveris the convenience wrapper aroundConnectRpcService, 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 discoveringServer::from_service(...)and threading config throughConnectRpcService::new(...)by hand. The compiler error doesn't point atfrom_service.Changes
Renames (breaking):
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(...)andwith_graceful_shutdown(...)are unchanged (alreadywith_*).ServeTlsis included because it has the samewith_graceful_shutdown/ bare-nametls_handshake_timeoutsplit asServer; renaming all three at once keeps the crate consistent.New proxies (additive):
Server::with_limits,Server::with_compression,Server::with_compression_policydelegating to the same-namedConnectRpcServicebuilders.BoundServerdoesn't get the dispatch proxies because it doesn't hold aConnectRpcService— it takes one atserve()time.Servergets them because it constructs the service innew().Sibling PRs
#103 adds
Server::with_deadline_policy()— sameServerimpl block, so whichever lands second has a small merge conflict inserver.rs(andCHANGELOG.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, andRUSTDOCFLAGS="-D warnings" cargo doc -p connectrpc --all-features --no-depsall clean. Net change ~71 lines excluding tests.