tattle 0.4.3

Error reporting for compilers
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub struct Loc {
    pub start: usize,
    pub end: usize,
}

impl Loc {
    pub fn new(start: usize, end: usize) -> Self {
        assert!(start <= end);
        Self { start, end }
    }

    pub fn slice<'a>(&self, source: &'a str) -> &'a str {
        &source[self.start..self.end]
    }
}