Skip to content

Commit f44989f

Browse files
Added derive attr for struct's and Debug impl
1 parent 62b18fa commit f44989f

4 files changed

Lines changed: 16 additions & 0 deletions

File tree

src/account/private_key.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use std::fmt;
3131
/// account.public_key().to_address(TESTNET).to_string()
3232
/// );
3333
/// ```
34+
#[derive(Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3435
pub struct PrivateKeyAccount([u8; SECRET_KEY_LENGTH], pub PublicKeyAccount);
3536

3637
impl PrivateKeyAccount {
@@ -87,6 +88,12 @@ impl PrivateKeyAccount {
8788
}
8889
}
8990

91+
impl fmt::Debug for PrivateKeyAccount {
92+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
93+
write!(f, "{}", self.0.to_base58())
94+
}
95+
}
96+
9097
impl fmt::Display for PrivateKeyAccount {
9198
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
9299
write!(f, "{}", self.0.to_base58())

src/account/public_key.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use std::fmt;
2424
/// account.public_key().to_address(TESTNET).to_string()
2525
/// );
2626
/// ```
27+
#[derive(Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2728
pub struct PublicKeyAccount(pub [u8; PUBLIC_KEY_LENGTH]);
2829

2930
impl PublicKeyAccount {
@@ -44,6 +45,12 @@ impl PublicKeyAccount {
4445
}
4546
}
4647

48+
impl fmt::Debug for PublicKeyAccount {
49+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
50+
write!(f, "{}", self.0.to_base58())
51+
}
52+
}
53+
4754
impl fmt::Display for PublicKeyAccount {
4855
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4956
write!(f, "{}", self.0.to_base58())

src/transaction.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub use version::*;
2828
/// );
2929
/// let signed_tx = account.sign_transaction(tx);
3030
/// ```
31+
#[derive(Debug)]
3132
pub struct Transaction<'a> {
3233
data: TransactionData<'a>,
3334
fee: u64,

src/transaction/transaction_data.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use crate::account::Address;
22
use crate::transaction::{Asset, DataEntry, TransactionId};
33

44
/// Data specific to a particular transaction type
5+
#[derive(Debug)]
56
pub enum TransactionData<'a> {
67
Issue {
78
name: &'a str,

0 commit comments

Comments
 (0)