Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::error::Error;
- use std::fmt;
- #[derive(Debug)]
- enum E {
- D(Box<Error + Send>),
- }
- impl fmt::Display for E {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- fmt::Debug::fmt(&self, f)
- }
- }
- impl Error for E {
- fn source(&self) -> Option<&(Error + 'static)> {
- match self {
- E::D(e) => Some(e),
- _ => None,
- }
- }
- }
- fn main() {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement