1use std::fmt::{Debug, Display, Formatter};
2
3#[derive(Debug, Clone, PartialEq, Eq)]
4pub struct Caller(pub String, pub String, pub u32);
5
6impl Caller {
7 pub fn function_name(&self) -> String {
8 self.0.to_string()
9 }
10
11 pub fn file(&self) -> String {
12 self.1.to_string()
13 }
14
15 pub fn line(&self) -> u32 {
16 self.2.clone()
17 }
18}
19impl Display for Caller {
20 fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
21 write!(
22 f,
23 " \x1b[1;38;5;79m{}\x1b[1;38;5;235m @ \x1b[1;38;5;159m{}:{}\x1b[0m",
24 self.function_name(),
25 self.file(),
26 self.line()
27 )
28 }
29}