macro_rules! derive_deftly_template_DynMethod { ( { $($driver:tt)* } [$($aoptions:tt)*] { $($future:tt)* } $($tpassthrough:tt)* ) => { ... }; ([$chain0:path, $($chains:path,)*] [$($accum:tt)*] $($passthrough:tt)*) => { ... }; ($($wrong:tt)*) => { ... }; }
Expand description
Declare that one or more space-separated types should be considered as dynamically dispatchable RPC methods.
§Example
use tor_rpcbase::{self as rpc, templates::*};
use derive_deftly::Deftly;
#[derive(Debug, serde::Deserialize, Deftly)]
#[derive_deftly(rpc::DynMethod)]
#[deftly(rpc(method_name = "x-example:castigate"))]
struct Castigate {
severity: f64,
offenses: Vec<String>,
accomplice: Option<rpc::ObjectId>,
}
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.
This is a derive_deftly template. Do not invoke it directly.
To use it, write: #[derive(Deftly)] #[derive_deftly(DynMethod)].