speakeasy

Crates.iospeakeasy
lib.rsspeakeasy
version0.1.0
created_at2025-04-17 09:52:13.601614+00
updated_at2025-04-17 09:52:13.601614+00
descriptionJSON-RPC 2.0 made easy!
homepagehttps://crates.io/crates/ez-jsonrpc
repositoryhttps://github.com/aatifsyed/ez-jsonrpc
max_upload_size
id1637441
size58,122
Aatif Syed (aatifsyed)

documentation

https://docs.rs/ez-jsonrpc

README

Completely generic request/response client built on tower::Service, futures::Stream and futures::Sink.

sequenceDiagram
    participant app as Your Application
    participant svc as ez_client::Service
    participant task as ez_client::Task
    participant transport as TransportT

    autonumber

    app->>svc: RequestT
    svc->>task: ez_client::Ask
    note over svc,task: message over a Sink/Stream
    task->>transport: (RequestT, IdT)
    note over task,transport: message over a Sink/Stream
    note over task: wait for response...
    transport->>task: (ResponseT, IdT)
    task->>app: ResponseT

  1. Create a [Service] and [Task].
    • Connect them to each other over a [Stream]/[Sink], allowing you to configure your own e.g queue depth, MPSC etc.
    • Give the [Task] a [Stream]/[Sink] transport to own. This is typically a wrapper over e.g a websocket connection.
  2. You call the [Service] with a [Dialogue].
  3. The [Service] formats this into an [Ask] for the [Task].
  4. The [Task] assigns the request an identifier for correlation using an [IdFactory], and sends the pair to the transport.
  5. A response eventually arrives on the transport.
  6. The [Task] reacts to the response, resolving the Future returned in (1).

[Task]s also handle timeouts, and propogating errors from the transport.

Commit count: 79

cargo fmt