1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use crate::Span;
pub type Result<'src, T> = std::result::Result<T, Box<Error<'src>>>;
#[derive(Debug, PartialEq, Eq)]
pub struct Error<'src> {
pub message: String,
pub span: Span<'src>,
pub source: &'src str,
}
impl<'src> Error<'src> {
pub fn new(message: String, span: Span<'src>, source: &'src str) -> Self {
Self {
message,
span,
source,
}
}
pub fn new_boxed(message: String, span: Span<'src>, source: &'src str) -> Box<Self> {
Self::new(message, span, source).into()
}
}