macro_rules! decl_method {
    {$($name:expr => $id:ident),* $(,)?} => { ... };
}
Expand description

Declare that one or more space-separated types should be considered as RPC methods.

Example

use tor_rpcbase as rpc;

#[derive(Debug, serde::Deserialize)]
struct Castigate {
   severity: f64,
   offenses: Vec<String>,
   accomplice: Option<rpc::ObjectId>,
}
rpc::decl_method!{ "x-example:castigate" => Castigate}

impl rpc::Method for Castigate {
    type Output = String;
    type Update = rpc::NoUpdates;
}

Limitations

For now you’ll need to import the typetag crate; unfortunately, it doesn’t yet behave well when used where it is not in scope as typetag.