bluejay_parser/error/
annotation.rs

1use crate::Span;
2use std::borrow::Cow;
3
4#[derive(Debug, PartialEq)]
5pub struct Annotation {
6    pub(crate) message: Cow<'static, str>,
7    pub(crate) span: Span,
8}
9
10impl Annotation {
11    pub fn new(message: impl Into<Cow<'static, str>>, span: Span) -> Self {
12        Self {
13            message: message.into(),
14            span,
15        }
16    }
17
18    pub fn message(&self) -> &str {
19        self.message.as_ref()
20    }
21
22    pub fn span(&self) -> &Span {
23        &self.span
24    }
25}