From a839c81506ba5581f3db079681c6ebd7aa2c0f7c Mon Sep 17 00:00:00 2001 From: sunny-g Date: Sat, 13 Jun 2020 21:39:19 -0500 Subject: [PATCH 1/2] impl Debug for Addr --- src/addr.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/addr.rs b/src/addr.rs index 7d10195..4adb003 100644 --- a/src/addr.rs +++ b/src/addr.rs @@ -2,6 +2,7 @@ use crate::{Actor, Caller, Context, Error, Handler, Message, Result, Sender}; use futures::channel::{mpsc, oneshot}; use futures::lock::Mutex; use futures::Future; +use std::fmt; use std::hash::{Hash, Hasher}; use std::pin::Pin; use std::sync::Arc; @@ -34,6 +35,14 @@ impl Clone for Addr { } } +impl fmt::Debug for Addr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_map() + .entry(&std::any::type_name::(), &self.actor_id) + .finish() + } +} + impl PartialEq for Addr { fn eq(&self, other: &Self) -> bool { self.actor_id == other.actor_id From 3e2b3a5e8aedbb6d70d47de14112e23892c970d1 Mon Sep 17 00:00:00 2001 From: sunny-g Date: Sat, 13 Jun 2020 21:43:08 -0500 Subject: [PATCH 2/2] use struct instead --- src/addr.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/addr.rs b/src/addr.rs index 4adb003..aad91ca 100644 --- a/src/addr.rs +++ b/src/addr.rs @@ -37,8 +37,8 @@ impl Clone for Addr { impl fmt::Debug for Addr { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_map() - .entry(&std::any::type_name::(), &self.actor_id) + f.debug_struct(&std::any::type_name::()) + .field("addr", &self.actor_id) .finish() } }