makepad_live_tokenizer/
live_error_origin.rs1use std::fmt;
2
3#[macro_export]
4macro_rules!live_error_origin{
5 () => {
6 LiveErrorOrigin { filename : file ! ( ) . to_string ( ) , line : line ! ( ) as usize }
7 }
8}
9
10#[derive(Clone, Default, PartialEq)]
11pub struct LiveErrorOrigin {
12 pub filename: String,
13 pub line:usize
14}
15
16impl fmt::Display for LiveErrorOrigin {
17 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
18 write!(f, "{}:{} ", self.filename, self.line)
19 }
20}
21
22impl fmt::Debug for LiveErrorOrigin {
23 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
24 write!(f, "{}:{} ", self.filename, self.line)
25 }
26}