blob: 62d9b5a4eda7f93121c84ea06d09c8e47ec46aa9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
use std::fmt;
#[derive(Clone, Copy, Debug, Hash, Eq, Ord, PartialEq, PartialOrd)]
pub struct LineCol {
/// One-indexed line.
pub line: usize,
/// Zero-indexed column.
pub col: usize,
}
impl Default for LineCol {
fn default() -> Self {
Self { line: 1, col: 0 }
}
}
impl fmt::Display for LineCol {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}:{}", self.line, self.col)
}
}
|