fixup! mv spans to separate span file

This commit is contained in:
Noah Hellman 2023-01-27 17:50:31 +01:00
parent d8d69b2488
commit f7ead5a69f

View file

@ -34,10 +34,18 @@ impl Span {
Self::by_len(self.start(), len) Self::by_len(self.start(), len)
} }
pub fn union(self, span: Self) -> Self {
Self::new(self.start(), span.end())
}
pub fn skip(self, n: usize) -> Self { pub fn skip(self, n: usize) -> Self {
Self::new(self.start() + n, self.end()) Self::new(self.start() + n, self.end())
} }
pub fn extend(self, n: usize) -> Self {
Self::new(self.start(), self.end() + n)
}
pub fn translate(self, n: usize) -> Self { pub fn translate(self, n: usize) -> Self {
Self::new( Self::new(
self.start().checked_add(n).unwrap(), self.start().checked_add(n).unwrap(),
@ -45,14 +53,6 @@ impl Span {
) )
} }
pub fn extend(self, n: usize) -> Self {
Self::new(self.start(), self.end() + n)
}
pub fn union(self, span: Self) -> Self {
Self::new(self.start(), span.end())
}
pub fn is_empty(self) -> bool { pub fn is_empty(self) -> bool {
self.start == self.end self.start == self.end
} }