• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // We can expose more detail on the error as the need arises, but start with an
2 // opaque error type for now.
3 
4 use std::error::Error as StdError;
5 use std::fmt::{self, Debug, Display};
6 
7 pub struct Error {
8     pub(crate) err: crate::gen::Error,
9 }
10 
11 impl From<crate::gen::Error> for Error {
from(err: crate::gen::Error) -> Self12     fn from(err: crate::gen::Error) -> Self {
13         Error { err }
14     }
15 }
16 
17 impl Display for Error {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result18     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
19         Display::fmt(&self.err, f)
20     }
21 }
22 
23 impl Debug for Error {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result24     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
25         Debug::fmt(&self.err, f)
26     }
27 }
28 
29 impl StdError for Error {
source(&self) -> Option<&(dyn StdError + 'static)>30     fn source(&self) -> Option<&(dyn StdError + 'static)> {
31         self.err.source()
32     }
33 }
34