Skip to content

Commit

Permalink
Implement Debug manually on Multiaddr
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaka committed Dec 15, 2017
1 parent d29ec87 commit 13d3463
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ mod errors;
pub use errors::{Result, Error};
pub use protocol::{ProtocolId, ProtocolArgSize, AddrComponent};

use std::fmt;
use std::iter::FromIterator;
use std::net::{SocketAddr, SocketAddrV4, SocketAddrV6, IpAddr, Ipv4Addr, Ipv6Addr};
use std::str::FromStr;

/// Representation of a Multiaddr.
#[derive(PartialEq, Eq, Clone, Debug, Hash)]
#[derive(PartialEq, Eq, Clone, Hash)]
pub struct Multiaddr {
bytes: Vec<u8>,
}
Expand All @@ -43,6 +44,13 @@ impl ToString for Multiaddr {
}
}

impl fmt::Debug for Multiaddr {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.to_string().fmt(f)
}
}

impl Multiaddr {
/// Create a new multiaddr based on a string representation, like
/// `/ip4/127.0.0.1/udp/1234`.
Expand Down

0 comments on commit 13d3463

Please sign in to comment.