add request_boxed_we

This commit is contained in:
Andrey Tkachenko 2021-08-20 17:18:56 +04:00
parent 7332c04e53
commit 73cf59afb8
2 changed files with 5 additions and 14 deletions

View File

@ -154,11 +154,10 @@ impl<M: fmt::Debug + 'static, E: StdSyncSendError> Error<M, E> {
}
}
pub fn try_unwrap(self) -> Option<E> {
pub fn try_unwrap(self) -> Result<E, Self> {
match self {
Error::Other(inner) => Some(inner),
Error::OtherBoxed(_) => None,
_ => None,
Error::Other(inner) => Ok(inner),
s => Err(s),
}
}
}

View File

@ -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<Box<dyn Message>>> {
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<Box<dyn Message>, Error<Box<dyn Message>>> {
if self.inner.closed.load(Ordering::SeqCst) {
println!("closed message bus");
warn!("closed message bus");
return Err(Error::NoResponse);
}