fixup! mv spans to separate span file
This commit is contained in:
parent
d8d69b2488
commit
f7ead5a69f
1 changed files with 8 additions and 8 deletions
16
src/span.rs
16
src/span.rs
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue