Skip to content

Commit

Permalink
Merge pull request #2 from foresterre/impl-debug-for-reporter-error
Browse files Browse the repository at this point in the history
  • Loading branch information
foresterre authored Jun 4, 2022
2 parents b74cdf4 + 751b6f5 commit b91da2c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/channel.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//! Channels which can be used by the `ChannelReporter` and `ChannelEventListener`.
use crate::Disconnect;
use std::fmt::Formatter;
use std::{any, fmt};

// --- Event channel variants

Expand Down Expand Up @@ -32,7 +34,13 @@ impl<T> EventReceiver<T> {
#[derive(PartialEq, Eq, Clone, Copy)]
pub struct EventSendError<T>(pub T);

#[derive(PartialEq, Eq, Clone, Copy)]
impl<T> fmt::Debug for EventSendError<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.write_fmt(format_args!("EventSendError({})", any::type_name::<T>()))
}
}

#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub struct EventRecvError;

// --- Disconnect channel variants
Expand Down
1 change: 1 addition & 0 deletions src/reporter/channel_reporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ impl<Event> Reporter for ChannelReporter<Event> {
}
}

#[derive(Debug)]
pub enum ReporterError<Event> {
SendError(crate::EventSendError<Event>),
DisconnectError(crate::DisconnectRecvError),
Expand Down

0 comments on commit b91da2c

Please sign in to comment.