graphics_error/builder/
mod.rs

1mod from_std;
2use crate::{GraphicsError, GraphicsErrorKind};
3use std::panic::Location;
4
5impl GraphicsError {
6    pub fn parse_error(message: String) -> Self {
7        Self { kind: GraphicsErrorKind::ParseError(message), line: 0, column: 0, file: None }
8    }
9}
10
11impl GraphicsErrorKind {
12    fn with_caller(self, location: Location) -> GraphicsError {
13        GraphicsError { kind: self, line: location.line(), column: location.column(), file: Some(location.file().to_string()) }
14    }
15}
16
17#[macro_export]
18macro_rules! parse_error {
19    ($e:expr) => {
20        Err(GraphicsError::parse_error($e.to_string()))
21    };
22    ($($arg:tt)*) => {
23        Err(GraphicsError::parse_error(format!($($arg)*)))
24    };
25}