diff --git a/src/error.rs b/src/error.rs index b4ade01..9e0e720 100644 --- a/src/error.rs +++ b/src/error.rs @@ -115,3 +115,27 @@ impl From for Error { } } } + +impl PartialEq for Error +where + E: PartialEq, +{ + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (Error::Permanent(ref self_err), Error::Permanent(ref other_err)) => { + self_err == other_err + } + ( + Error::Transient { + err: self_err, + retry_after: self_retry_after, + }, + Error::Transient { + err: other_err, + retry_after: other_retry_after, + }, + ) => self_err == other_err && self_retry_after == other_retry_after, + _ => false, + } + } +}