Allow selecting a backend per client - #53
Merged
Merged
Conversation
Owner
|
Regarding custom backends this is what I have in mind: db820ca. wdyt? The panic with no global backend configured is meant to highlight the incomplete setup to the end user as early as possible. I still suggest keeping it as is. |
Contributor
Author
|
Thanks, this approach works for our use case. I've updated the PR to use the generic builder state and |
cavivie
force-pushed
the
feature/client-backend-selection
branch
from
August 31, 2026 03:00
550881b to
bfe18f6
Compare
Owner
|
thanks! |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Nyquest currently relies on one process-global backend. That works well for the preset path, but makes it difficult for an application to use different native transports or for a library or test to inject a backend without changing global state.
This adds
custom_backendtoClientBuilder. A builder uses the registered global backend by default, while callers can explicitly provide a backend for an individual client. The resulting client remains type-erased, so the backend type does not propagate through application APIs.The existing global registration and missing-backend panic behavior remain unchanged.
This implements the custom backend per client part of #1. It is also useful groundwork for per-client Android backend selection discussed in #52, but does not add a Cronet backend itself.
Tested with:
cargo test -p nyquest --all-featurescargo clippy -p nyquest --all-targets --all-features -- -D warnings