corepc_client/client_sync/v17/
control.rs

1// SPDX-License-Identifier: CC0-1.0
2
3//! Macros for implementing JSON-RPC methods on a client.
4//!
5//! Specifically this is methods found under the `== Control ==` section of the
6//! API docs of Bitcoin Core `v0.17`.
7//!
8//! All macros require `Client` to be in scope.
9//!
10//! See or use the `define_jsonrpc_minreq_client!` macro to define a `Client`.
11
12/// Implements Bitcoin Core JSON-RPC API method `getmemoryinfo`.
13#[macro_export]
14macro_rules! impl_client_v17__get_memory_info {
15    () => {
16        impl Client {
17            pub fn get_memory_info(&self) -> Result<GetMemoryInfoStats> {
18                self.call("getmemoryinfo", &[])
19            }
20        }
21    };
22}
23
24/// Implements Bitcoin Core JSON-RPC API method `help`.
25#[macro_export]
26macro_rules! impl_client_v17__help {
27    () => {
28        impl Client {
29            pub fn help(&self) -> Result<String> { self.call("help", &[]) }
30        }
31    };
32}
33
34/// Implements Bitcoin Core JSON-RPC API method `logging`.
35#[macro_export]
36macro_rules! impl_client_v17__logging {
37    () => {
38        impl Client {
39            pub fn logging(&self) -> Result<Logging> { self.call("logging", &[]) }
40        }
41    };
42}
43
44/// Implements Bitcoin Core JSON-RPC API method `stop`.
45#[macro_export]
46macro_rules! impl_client_v17__stop {
47    () => {
48        impl Client {
49            pub fn stop(&self) -> Result<String> { self.call("stop", &[]) }
50        }
51    };
52}
53
54/// Implements Bitcoin Core JSON-RPC API method `uptime`.
55#[macro_export]
56macro_rules! impl_client_v17__uptime {
57    () => {
58        impl Client {
59            pub fn uptime(&self) -> Result<u32> { self.call("uptime", &[]) }
60        }
61    };
62}