• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use alloc::boxed::Box;
2 use core::fmt::{self, Display};
3 
4 /// Exception thrown from an `extern "C++"` function.
5 #[derive(Debug)]
6 pub struct Exception {
7     pub(crate) what: Box<str>,
8 }
9 
10 impl Display for Exception {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result11     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
12         f.write_str(&self.what)
13     }
14 }
15 
16 impl std::error::Error for Exception {}
17 
18 impl Exception {
19     #[allow(missing_docs)]
what(&self) -> &str20     pub fn what(&self) -> &str {
21         &self.what
22     }
23 }
24