use smol_str::SmolStr;
use lsp_types::Position;
#[derive(Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct Error {
start: Position,
message: SmolStr,
end: Option<Position>,
}
impl Error {
#[inline]
pub fn new(start: Position, message: impl Into<SmolStr>, end: Option<Position>) -> Self {
Self {
start,
message: message.into(),
end,
}
}
#[inline]
pub const fn start(&self) -> Position {
self.start
}
#[inline]
pub fn message(&self) -> &str {
&self.message
}
#[inline]
pub const fn end(&self) -> Option<Position> {
self.end
}
}