Skip to content

Commit

Permalink
serde camelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
liuchengxu committed Aug 4, 2024
1 parent 7a49dec commit 528c361
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/subcoin-network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ pub enum SyncStrategy {

/// Represents the sync status of node.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SyncStatus {
/// The node is idle and not currently major syncing.
Idle,
Expand All @@ -192,6 +193,7 @@ pub enum SyncStatus {

/// Represents the status of network.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct NetworkStatus {
/// The number of peers currently connected to the node.
pub num_connected_peers: usize,
Expand Down Expand Up @@ -219,6 +221,7 @@ impl Clone for Bandwidth {
}

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SendTransactionResult {
Success(Txid),
Failure(String),
Expand Down
3 changes: 3 additions & 0 deletions crates/subcoin-network/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const LATENCY_IMPROVEMENT_THRESHOLD: f64 = 1.2;

/// The state of syncing between a Peer and ourselves.
#[derive(Copy, Clone, Eq, PartialEq, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PeerSyncState {
/// Available for sync requests.
Available,
Expand All @@ -42,6 +43,7 @@ impl PeerSyncState {

/// Ping letency of the peer.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PeerLatency {
Unknown,
Average(Latency),
Expand All @@ -66,6 +68,7 @@ impl PartialOrd for PeerLatency {

/// Contains all the data about a Peer that we are trying to sync with.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PeerSync {
/// Peer id of this peer.
pub peer_id: PeerId,
Expand Down
1 change: 1 addition & 0 deletions crates/subcoin-rpc/src/subcoin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use subcoin_network::{
};

#[derive(Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct NetworkPeers {
total: usize,
available: usize,
Expand Down

0 comments on commit 528c361

Please sign in to comment.