1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)] struct Location { line: u32, column: u32, } #[derive(Debug, Clone)] struct Scanner<'s> { location: Location, content: std::str::Chars<'s>, } impl<'s> Scanner<'s> { fn new(content: &'s str) -> Self { Self { location: Default::default(), content: content.chars(), } } }