Macro postcard_rpc::endpoint

source ·
macro_rules! endpoint {
    ($tyname:ident, $req:ty, $resp:ty) => { ... };
    ($tyname:ident, $req:ty, $resp:ty, $path:expr,) => { ... };
    ($tyname:ident, $req:ty, $resp:ty, $path:expr) => { ... };
}
Expand description

§Endpoint macro

Used to define a single Endpoint marker type that implements the Endpoint trait.

use postcard_rpc::endpoint;

#[derive(Debug, Serialize, Deserialize, Schema)]
pub struct Req1 {
    a: u8,
    b: u64,
}

#[derive(Debug, Serialize, Deserialize, Schema)]
pub struct Resp1 {
    c: [u8; 4],
    d: i32,
}

endpoint!(Endpoint1, Req1, Resp1, "endpoint/1");

If the path is omitted, the type name is used instead.