summaryrefslogtreecommitdiff
path: root/src/syntax/span.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/syntax/span.rs')
-rw-r--r--src/syntax/span.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/syntax/span.rs b/src/syntax/span.rs
index c26011bd..47d96589 100644
--- a/src/syntax/span.rs
+++ b/src/syntax/span.rs
@@ -88,6 +88,11 @@ impl Span {
Self { end, ..self }
}
+ /// The byte length of the spanned region.
+ pub fn len(self) -> usize {
+ self.end - self.start
+ }
+
/// A new span at the position of this span's start.
pub fn at_start(&self) -> Span {
Self::at(self.source, self.start)