rr-mux 0.1.0

A Request Response Multiplexer for building protocol handlers etc.
Documentation
1
2
3
4
5
6
7
8
9
10
11

use futures::Future;

/// Connector provides support for making and responding to requests
pub trait Connector<ID, ADDR, REQ, RESP, ERR> {
    // Send a request and receive a response or error at some time in the future
    fn request(&mut self, id: ID, addr: ADDR, req: REQ) -> Box<Future<Item=RESP, Error=ERR>>;

    // Send a response message
    fn respond(&mut self, id: ID, addr: ADDR, resp: RESP) -> Box<Future<Item=(), Error=ERR>>;
}