1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#[macro_use]
mod macros;
mod tape;
pub use tape::{Tape, Value, Walue};
pub type Error = std::io::Error;
#[derive(Debug)]
pub struct ErrorWithSource {
pub description: String,
pub source: Error,
}
pub type Result<T> = std::io::Result<T>;
impl std::fmt::Display for ErrorWithSource {
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "{}, due to {}", self.description, self.source)
}
}
impl std::error::Error for ErrorWithSource {
#[inline]
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
Some(&self.source)
}
}