1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/// Representation of any location in the given input
#[repr(C)]
#[derive(Clone, PartialEq, Eq, Copy, Default)]
pub struct Loc {
    /// Begin of the `Loc` range
    pub begin: usize,
    /// End of the `Loc` range
    pub end: usize,
}

impl Loc {
    /// Constructs a new Loc struct
    pub fn new(begin: usize, end: usize) -> Loc {
        Self { begin, end }
    }

    /// Returns `begin` field of the `Loc`
    pub fn begin(&self) -> usize {
        self.begin
    }

    /// Returns `end` field of the `Loc`
    pub fn end(&self) -> usize {
        self.end
    }
}