1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#[cfg(feature = "serialization")]
use serde::{Deserialize, Serialize};
use crate::{ColumnIndex, LineIndex};
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serialization", derive(Deserialize, Serialize))]
pub struct Location {
pub line: LineIndex,
pub column: ColumnIndex,
}
impl Location {
pub fn new(line: impl Into<LineIndex>, column: impl Into<ColumnIndex>) -> Location {
Location {
line: line.into(),
column: column.into(),
}
}
}