Macro interchange::interchange
source · [−]macro_rules! interchange {
($Name:ident: ($REQUEST:ty, $RESPONSE:ty)) => { ... };
($Name:ident: ($REQUEST:ty, $RESPONSE:ty, $N:expr)) => { ... };
}
Expand description
Use this macro to generate a pair of RPC pipes for any pair of Request/Response enums you wish to implement.
use interchange::Interchange as _;
use interchange::interchange;
#[derive(Clone, Debug, PartialEq)]
pub enum Request {
This(u8, u32),
That(i64),
}
#[derive(Clone, Debug, PartialEq)]
pub enum Response {
Here(u8, u8, u8),
There(i16),
}
interchange::interchange! {
ExampleInterchange: (Request, Response)
}
Note
The syntax to setup multiple copies of a given interchange (for instance,
we use this in trussed
for multi-client) is horrible. Please let the
authers know if there’s a better way, than the current
interchange!(Name: (Request, Response), 3, [None, None, None])
etc.