Expand description
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
- Create a
Service
andTask
. - You
call
theService
with aDialogue
. - The
Service
formats this into anAsk
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.
Modules§
- ask
- Contains
ask::Kind
. - dialogue
- Types when a
Service
handles aDialogue
. - error_
factory - Utility implementors of
ErrorFactory
. - future
Future
s used by this crate.- id_
factory - Utility implementations of
IdFactory
. - notification
- Types when a
Service
handles aNotification
. - task
- Contains
task::Error
, emitted by aTask
. - util
- General utilities.
Structs§
- Ask
- Application-level input to a
Task
. - Dialogue
- Indicate to a
Service
that theTask
should assign an ID, and wait for a response until the timeout. - Notification
- Indicate to a
Service
that theTask
should NOT assign an ID, or wait for a response. - Service
- Implementor of
Service
which dispatches to aTask
. - Task
- Generic dispatcher for notifications and request/response pairs.
Traits§
- Error
Factory - A transport error for `Task which can be broadcast to all clients.
- IdFactory
- Issuer of identifiers for requests in
Task
.