SHARE
TWEET

Untitled

a guest Apr 21st, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use std::error::Error;
  2. use std::fmt;
  3.  
  4. #[derive(Debug)]
  5. enum E {
  6.     D(Box<Error + Send>),
  7. }
  8.  
  9. impl fmt::Display for E {
  10.     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
  11.         fmt::Debug::fmt(&self, f)
  12.     }
  13. }
  14.  
  15. impl Error for E {
  16.     fn source(&self) -> Option<&(Error + 'static)> {
  17.         match self {
  18.             E::D(e) => Some(e),
  19.             _ => None,
  20.         }
  21.     }
  22. }
  23.  
  24. fn main() {
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top