From 06eea4225b01329ac8faa9cc2a41a61d702b7d92 Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Fri, 22 May 2020 22:08:23 +0200 Subject: [PATCH] feat: add PartialEq and Eq for channel Errors Closes #792 --- src/sync/channel.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sync/channel.rs b/src/sync/channel.rs index 8ab1cc1..3207846 100644 --- a/src/sync/channel.rs +++ b/src/sync/channel.rs @@ -992,6 +992,7 @@ impl Drop for Channel { /// An error returned from the `try_send` method. #[cfg(feature = "unstable")] #[cfg_attr(feature = "docs", doc(cfg(unstable)))] +#[derive(PartialEq, Eq)] pub enum TrySendError { /// The channel is full but not disconnected. Full(T), @@ -1023,7 +1024,7 @@ impl Display for TrySendError { /// An error returned from the `try_recv` method. #[cfg(feature = "unstable")] #[cfg_attr(feature = "docs", doc(cfg(unstable)))] -#[derive(Debug)] +#[derive(Debug, PartialEq, Eq)] pub enum TryRecvError { /// The channel is empty but not disconnected. Empty, @@ -1046,7 +1047,7 @@ impl Display for TryRecvError { /// An error returned from the `recv` method. #[cfg(feature = "unstable")] #[cfg_attr(feature = "docs", doc(cfg(unstable)))] -#[derive(Debug)] +#[derive(Debug, PartialEq, Eq)] pub struct RecvError; impl Error for RecvError {}