diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-11-07 23:31:42 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-11-08 11:52:09 +0100 |
| commit | 75fffc1f9b6ef8bf258b2b1845a4ba74a0f5f2c1 (patch) | |
| tree | e8c841d9d9323fc3cff0f584f3267743e809dd25 /src/syntax/span.rs | |
| parent | 95866d5fc9ae89a23c5754193c7de5d4fe4873b1 (diff) | |
Fine-grained capturing
Diffstat (limited to 'src/syntax/span.rs')
| -rw-r--r-- | src/syntax/span.rs | 5 |
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) |
