bitcoind_request/command/
get_connection_count.rs1use crate::command::CallableCommand;
14use crate::{client::Client, command::request::request};
15use serde::{Deserialize, Serialize};
16use serde_json::value::RawValue;
17
18pub struct GetConnectionCountCommand {}
19impl GetConnectionCountCommand {
20 pub fn new() -> Self {
21 GetConnectionCountCommand {}
22 }
23}
24
25#[derive(Serialize, Deserialize, Debug)]
26pub struct GetConnectionCountCommandResponse(pub u64);
27
28impl CallableCommand for GetConnectionCountCommand {
29 type Response = GetConnectionCountCommandResponse;
30 fn call(&self, client: &Client) -> Result<Self::Response, jsonrpc::Error> {
31 let command = "getconnectioncount";
32 let params: Vec<Box<RawValue>> = vec![];
33 let r = request(client, command, params);
34 let response: GetConnectionCountCommandResponse = r.result()?;
35 Ok(response)
36 }
37}