Skip to content

Conversation

@ValuedMammal
Copy link
Collaborator

Description

Gathering feedback on a new sans-io implementation. To make it work I restructured the API to allow consumers to send their own requests. This way the library need only be concerned with modeling the RPCs and handling responses.

Motivation

Right now we're limited to making RPC requests with something that implements the Transport trait. This is general enough to be implemented by consumers of the library but doesn't immediately support, for example, asynchronous I/O out of the box. The benefit of "sans-io" is that we eliminate an entire class of issues related to network I/O. The result is better separation of concerns, ease of maintenance, and increased flexibility for the user who is no longer forced to conform to a specific Transport API.

Summary of Changes

  • Restructure the Client API to form the jsonrpc::Request to be executed by the caller
  • RPC methods are strongly typed
  • Provide a blocking client using bitreq out of the box for common use case
  • See examples/ directory for API usage example

Fixes compile error on Rust 1.75.0 since
`core::error` is only available after 1.81.0.
Changed `send_fn` argument in `call_async` to take an owned `Value`
in order to workaround the lifetime constraint in the absence
of `AsyncFn`.
@tvpeter
Copy link
Collaborator

tvpeter commented Feb 3, 2026

The separation of concerns sounds excellent.

@tvpeter tvpeter mentioned this pull request Feb 3, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants