add Display impl for Mismatch

This commit is contained in:
Robert Habermeier 2016-05-20 15:27:20 -04:00
parent cf9b6e9e07
commit 5e1229366d

View File

@ -66,6 +66,12 @@ pub struct Mismatch<T: fmt::Debug> {
pub found: T,
}
impl<T: fmt::Debug + fmt::Display> fmt::Display for Mismatch<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_fmt(format_args!("Expected {}, found {}", self.expected, self.found))
}
}
#[derive(Debug, PartialEq, Eq)]
/// Error indicating value found is outside of a valid range.
pub struct OutOfBounds<T: fmt::Debug> {