1#![allow(unused, non_snake_case)]
2pub mod caller;
3pub mod color;
4pub mod macros;
5pub use caller::Caller;
6
7pub trait Traceback: std::error::Error {
8 fn message(&self) -> String;
9 fn with(&self, caller: crate::Caller) -> Self;
10 fn callers(&self) -> Vec<crate::Caller>;
11
12 fn callers_to_string(&self, indent: usize) -> String {
13 let indentation = " ".repeat(indent).to_string();
14 self.callers()
15 .iter()
16 .enumerate()
17 .map(|(index, caller)| format!("{}{}", indentation.repeat(index), caller))
18 .collect::<Vec<String>>()
19 .join("\n")
20 }
21
22 fn highlight_message(&self) -> String {
23 format!("{}", self.message())
24 }
25 fn previous_as_debug(&self) -> String {
26 String::new()
27 }
28 fn previous_as_string(&self) -> String {
29 String::new()
30 }
31}