1 unstable release
new 0.1.0 | Apr 17, 2025 |
---|
#3 in #ask
51KB
1K
SLoC
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<script type="module"> import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs"; var doc_theme = localStorage.getItem("rustdoc-theme"); if (doc_theme === "dark" || doc_theme === "ayu") mermaid.initialize({theme: "dark"}); </script>
- Create a
Service
andTask
. - You
call
theService
with aDialogue
. - The
Service
formats this into an [Ask
] for theTask
. - The
Task
assigns the request an identifier for correlation using anIdFactory
, and sends the pair to the transport. - A response eventually arrives on the transport.
- The
Task
reacts to the response, resolving theFuture
returned in(1)
.
Task
s also handle timeouts, and propogating errors from the transport.
Dependencies
~1.6–2.4MB
~42K SLoC