Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

Commit

Permalink
tendermint-rs: impl Serialize for account::Id and node::Id
Browse files Browse the repository at this point in the history
  • Loading branch information
tony-iqlusion committed Apr 15, 2019
1 parent 248c39d commit 39cfe2d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion tendermint-rs/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::error::Error;
#[cfg(feature = "serde")]
use serde::de::{self, Deserialize, Deserializer};
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
use sha2::{Digest, Sha256};
use signatory::ecdsa::curve::secp256k1;
use std::{
Expand Down Expand Up @@ -98,3 +98,10 @@ impl<'de> Deserialize<'de> for Id {
})
}
}

#[cfg(feature = "serde")]
impl Serialize for Id {
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
self.to_string().serialize(serializer)
}
}
9 changes: 8 additions & 1 deletion tendermint-rs/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::error::Error;
#[cfg(feature = "serde")]
use serde::de::{self, Deserialize, Deserializer};
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
use sha2::{Digest, Sha256};
use signatory::ed25519;
use std::{
Expand Down Expand Up @@ -98,3 +98,10 @@ impl<'de> Deserialize<'de> for Id {
})
}
}

#[cfg(feature = "serde")]
impl Serialize for Id {
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
self.to_string().serialize(serializer)
}
}

0 comments on commit 39cfe2d

Please sign in to comment.