Repository navigation
feat: Add Client::call_async - #59
Merged
Merged
Conversation
ValuedMammal
force-pushed
the
feat/call_async
branch
from
July 10, 2026 14:36
322e6b5 to
c0cfa04
Compare
tvpeter
reviewed
Jul 28, 2026
tvpeter
reviewed
Jul 28, 2026
tvpeter
left a comment
Collaborator
There was a problem hiding this comment.
Thank you for working on this.
The implementation is sound and good to go.
I left a nit.
ValuedMammal
commented
Aug 5, 2026
Comment on lines
+25
to
+26
| bitreq = { version = "0.3.7", features = ["async"] } | ||
| tokio = { version = "1", features = ["full"] } |
Contributor
Author
There was a problem hiding this comment.
Rather than pull in these dev-dependencies right now, we could add Client::call_async in a separate commit (23c6fd6) and leave the async example as a draft.
ValuedMammal
force-pushed
the
feat/call_async
branch
from
August 5, 2026 14:43
b1daa05 to
4efcfab
Compare
Contributor
Author
|
I may have figured out a cleaner solution to call_async by simplifying the send_fn at the callsite.
|
ValuedMammal
force-pushed
the
feat/call_async
branch
from
August 24, 2026 17:38
c211e43 to
48901da
Compare
ValuedMammal
marked this pull request as ready for review
August 24, 2026 18:40
tvpeter
reviewed
Aug 25, 2026
tvpeter
approved these changes
Aug 26, 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 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.
Description
This PR adds
Client::call_async, an async counterpart to the existingClient::callmethod. It mirrors the sync implementation, by building a JSON-RPCRequestwith an auto-incremented ID, invoking a caller-suppliedsend_fnto perform the transport, verifying the response ID matches the request ID, and deserializing the result intoT, but accepts anAsyncFn(&Request) -> Result<Response, E>and awaits the response instead of calling a blocking closure. SinceClientremains sans-io, this lets consumers plug in an async transport without needing a parallel async client type or duplicating request/response handling logic.Notes to the reviewers
call_async'ssend_fnclosure takes thejsonrpc::Requestby reference (&Request) rather than by value like the synccall. This is for ergonomic reasons, as serializing to JSON usingserde_jsonis typically non-consuming. Error handling, ID validation, and serialization logic are otherwise identical tocall.Changelog notice
Client::call_asyncfor making JSON-RPC calls with an asyncsend_fntransport.Checklists
All Submissions:
just pre-pushbefore committingNew Features: