From 4abdafcd158ab15d9d2ae18553067578ae559d33 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 13 Jan 2022 19:49:52 +0100 Subject: Faster byte/utf-16 offset conversions --- src/parse/scanner.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/parse') diff --git a/src/parse/scanner.rs b/src/parse/scanner.rs index 6db89132..81fa4fba 100644 --- a/src/parse/scanner.rs +++ b/src/parse/scanner.rs @@ -19,6 +19,11 @@ impl<'s> Scanner<'s> { Self { src, index: 0 } } + /// Whether the end of the string is reached. + pub fn eof(&self) -> bool { + self.index == self.src.len() + } + /// Consume the next char. #[inline] pub fn eat(&mut self) -> Option { -- cgit v1.2.3