From f7ead5a69fb45ee4290df5f33e3b56c4d61a4261 Mon Sep 17 00:00:00 2001 From: Noah Hellman Date: Fri, 27 Jan 2023 17:50:31 +0100 Subject: [PATCH] fixup! mv spans to separate span file --- src/span.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/span.rs b/src/span.rs index 5da9670..ae05d48 100644 --- a/src/span.rs +++ b/src/span.rs @@ -34,10 +34,18 @@ impl Span { 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 { 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 { Self::new( 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 { self.start == self.end }