64: Add Error::source r=nox a=AnderEnder

As discussed in https://github.com/nox/serde_urlencoded/pull/63 `Error::source` was added in `1.30.0`

This PR implements `Error::source`

Co-authored-by: Andrii Radyk <ander.ender@gmail.com>
This commit is contained in:
bors[bot] 2020-02-10 11:15:28 +00:00 committed by GitHub
commit bf16076bce

View File

@ -86,6 +86,14 @@ impl error::Error for Error {
Error::Utf8(ref err) => Some(err),
}
}
/// The lower-level source of this error, in the case of a `Utf8` error.
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
match *self {
Error::Custom(_) => None,
Error::Utf8(ref err) => Some(err),
}
}
}
impl ser::Error for Error {