1use smol_str::SmolStr;
4use lsp_types::Position;
5
6#[derive(Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
8#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
9pub struct Error {
10 start: Position,
12
13 message: SmolStr,
15
16 end: Option<Position>,
18}
19
20impl Error {
21 #[inline]
23 pub fn new(start: Position, message: impl Into<SmolStr>, end: Option<Position>) -> Self {
24 Self {
25 start,
26 message: message.into(),
27 end,
28 }
29 }
30
31 #[inline]
33 pub const fn start(&self) -> Position {
34 self.start
35 }
36
37 #[inline]
39 pub fn message(&self) -> &str {
40 &self.message
41 }
42
43 #[inline]
45 pub const fn end(&self) -> Option<Position> {
46 self.end
47 }
48}