From 73cf59afb84c3458f4d0bf2c62ecaa582ed774fc Mon Sep 17 00:00:00 2001 From: Andrey Tkachenko Date: Fri, 20 Aug 2021 17:18:56 +0400 Subject: [PATCH] add request_boxed_we --- src/error.rs | 7 +++---- src/lib.rs | 12 ++---------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/error.rs b/src/error.rs index 02dd743..ecc5f32 100644 --- a/src/error.rs +++ b/src/error.rs @@ -154,11 +154,10 @@ impl Error { } } - pub fn try_unwrap(self) -> Option { + pub fn try_unwrap(self) -> Result { match self { - Error::Other(inner) => Some(inner), - Error::OtherBoxed(_) => None, - _ => None, + Error::Other(inner) => Ok(inner), + s => Err(s), } } } diff --git a/src/lib.rs b/src/lib.rs index e4226a1..205ea45 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -88,7 +88,6 @@ impl Bus { pub(crate) fn init(&self) { for (_, rs) in &self.inner.receivers { for r in rs { - println!("init {}", r.name()); r.init(self).unwrap(); } } @@ -245,13 +244,6 @@ impl Bus { return Err(SendError::Closed(msg).into()); } - for r in &self.inner.receivers { - println!("{:?}: ", r.0); - for i in r.1 { - println!(" {:?}: ", i.name()); - } - } - let tt = msg.type_tag(); let mid = ID_COUNTER.fetch_add(1, Ordering::Relaxed); @@ -531,7 +523,7 @@ impl Bus { _options: SendOptions, ) -> Result<(), Error>> { if self.inner.closed.load(Ordering::SeqCst) { - println!("closed message bus"); + warn!("closed message bus"); return Err(Error::NoResponse); } @@ -552,7 +544,7 @@ impl Bus { options: SendOptions, ) -> Result, Error>> { if self.inner.closed.load(Ordering::SeqCst) { - println!("closed message bus"); + warn!("closed message bus"); return Err(Error::NoResponse); }