summaryrefslogtreecommitdiff
path: root/src/syntax/span.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-11-07 23:31:42 +0100
committerLaurenz <laurmaedje@gmail.com>2021-11-08 11:52:09 +0100
commit75fffc1f9b6ef8bf258b2b1845a4ba74a0f5f2c1 (patch)
treee8c841d9d9323fc3cff0f584f3267743e809dd25 /src/syntax/span.rs
parent95866d5fc9ae89a23c5754193c7de5d4fe4873b1 (diff)
Fine-grained capturing
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)