clightningrpc_plugin/
macros.rs1#[macro_export]
7macro_rules! add_rpc {
8 ($plugin:expr, $method:ident) => {
9 let rpc = $method::new();
10 $plugin.add_rpc_method(
11 rpc.name.as_str(),
12 rpc.usage.as_str(),
13 rpc.description.as_str(),
14 rpc.clone(),
15 );
16 };
17}
18
19#[macro_export]
21macro_rules! register_notification {
22 ($plugin:expr, $notification:ident) => {
23 let callback = $notification::new();
24 $plugin.register_notification(callback.on_event.as_str(), callback.clone());
25 };
26}
27
28#[macro_export]
30macro_rules! error {
31 ($($msg:tt)*) => {{
32 let msg = format!($($msg)*);
33 PluginError::new(-1, &msg, None)
34 }};
35}
36
37pub use add_rpc;
38pub use error;
39pub use register_notification;