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
ServiceandTask. - You
calltheServicewith aDialogue. - The
Serviceformats this into anAskfor theTask. - The
Taskassigns the request an identifier for correlation using anIdFactory, and sends the pair to the transport. - A response eventually arrives on the transport.
- The
Taskreacts to the response, resolving theFuturereturned in(1).
Tasks also handle timeouts, and propogating errors from the transport.
Modules§
- ask
- Contains
ask::Kind. - dialogue
- Types when a
Servicehandles aDialogue. - error_
factory - Utility implementors of
ErrorFactory. - future
Futures used by this crate.- id_
factory - Utility implementations of
IdFactory. - notification
- Types when a
Servicehandles aNotification. - task
- Contains
task::Error, emitted by aTask. - util
- General utilities.
Structs§
- Ask
- Application-level input to a
Task. - Dialogue
- Indicate to a
Servicethat theTaskshould assign an ID, and wait for a response until the timeout. - Notification
- Indicate to a
Servicethat theTaskshould NOT assign an ID, or wait for a response. - Service
- Implementor of
Servicewhich 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.