webwire_cli/common.rs
1use nom::AsBytes;
2use nom_locate::LocatedSpan;
3
4#[derive(Clone, Debug, PartialEq)]
5pub struct FilePosition {
6 pub line: u32,
7 pub column: usize,
8}
9
10impl<T: AsBytes> From<LocatedSpan<T>> for FilePosition {
11 fn from(span: LocatedSpan<T>) -> Self {
12 Self {
13 line: span.location_line(),
14 column: span.get_utf8_column(),
15 }
16 }
17}