()
| 48 | |
| 49 | #[tokio::main] |
| 50 | async fn main() -> Result<(), anyhow::Error> { |
| 51 | let state = (); |
| 52 | |
| 53 | let test_dynamic_option: BooleanConfigOption = BooleanConfigOption::new_bool_no_default( |
| 54 | "test-dynamic-option", |
| 55 | "A option that can be changed dynamically", |
| 56 | ) |
| 57 | .dynamic(); |
| 58 | |
| 59 | if let Some(plugin) = Builder::new(tokio::io::stdin(), tokio::io::stdout()) |
| 60 | .option(TEST_OPTION) |
| 61 | .option(TEST_OPTION_NO_DEFAULT) |
| 62 | .option(test_dynamic_option) |
| 63 | .option(TEST_MULTI_STR_OPTION) |
| 64 | .option(TEST_MULTI_STR_OPTION_DEFAULT) |
| 65 | .option(TEST_MULTI_I64_OPTION) |
| 66 | .option(TEST_MULTI_I64_OPTION_DEFAULT) |
| 67 | .setconfig_callback(setconfig_callback) |
| 68 | .rpcmethod("testmethod", "This is a test", testmethod) |
| 69 | .rpcmethod( |
| 70 | "testoptions", |
| 71 | "Retrieve options from this plugin", |
| 72 | testoptions, |
| 73 | ) |
| 74 | .rpcmethod( |
| 75 | "test-custom-notification", |
| 76 | "send a test_custom_notification event", |
| 77 | test_send_custom_notification, |
| 78 | ) |
| 79 | .rpcmethod("test-log-levels", "send on all log levels", test_log_levels) |
| 80 | .subscribe("connect", connect_handler) |
| 81 | .subscribe("test_custom_notification", test_receive_custom_notification) |
| 82 | .hook_from_builder( |
| 83 | HookBuilder::new("peer_connected", peer_connected_handler) |
| 84 | .after(Vec::new()) |
| 85 | .before(Vec::new()) |
| 86 | .filters(Vec::new()), |
| 87 | ) |
| 88 | .notification(messages::NotificationTopic::new(TEST_NOTIF_TAG)) |
| 89 | .start(state) |
| 90 | .await? |
| 91 | { |
| 92 | plugin.join().await |
| 93 | } else { |
| 94 | Ok(()) |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | async fn setconfig_callback( |
| 99 | plugin: Plugin<()>, |
nothing calls this directly
no test coverage detected