Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement