• 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 #[allow(missing_docs)]
8 pub struct Error {
9     pub(crate) err: crate::gen::Error,
10 }
11 
12 impl From<crate::gen::Error> for Error {
from(err: crate::gen::Error) -> Self13     fn from(err: crate::gen::Error) -> Self {
14         Error { err }
15     }
16 }
17 
18 impl Display for Error {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result19     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
20         Display::fmt(&self.err, f)
21     }
22 }
23 
24 impl Debug for Error {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result25     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
26         Debug::fmt(&self.err, f)
27     }
28 }
29 
30 impl StdError for Error {
source(&self) -> Option<&(dyn StdError + 'static)>31     fn source(&self) -> Option<&(dyn StdError + 'static)> {
32         self.err.source()
33     }
34 }
35