mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-05-28 02:01:20 +00:00
More concerns fixes
This commit is contained in:
parent
c86e91babc
commit
00cc5c5a85
@ -23,7 +23,14 @@ pub struct Multiaddr {
|
||||
bytes: Vec<u8>,
|
||||
}
|
||||
|
||||
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 fmt::Display for Multiaddr {
|
||||
/// Convert a Multiaddr to a string
|
||||
///
|
||||
/// # Examples
|
||||
@ -35,19 +42,12 @@ impl ToString for Multiaddr {
|
||||
/// assert_eq!(address.to_string(), "/ip4/127.0.0.1/udt");
|
||||
/// ```
|
||||
///
|
||||
fn to_string(&self) -> String {
|
||||
let mut out = String::new();
|
||||
for s in self.iter() {
|
||||
out.push_str(&s.to_string());
|
||||
}
|
||||
out
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for Multiaddr {
|
||||
#[inline]
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
self.to_string().fmt(f)
|
||||
for s in self.iter() {
|
||||
s.to_string().fmt(f)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user