From 1d152cd78feb7667fab4ee8e938349da467c8984 Mon Sep 17 00:00:00 2001 From: Andrew Golovashevich Date: Sat, 15 Nov 2025 19:37:28 +0300 Subject: [PATCH] Noop pos counter --- default-streams/src/pos/mod.rs | 1 + default-streams/src/pos/nop.rs | 12 ++++++++++++ src/lib.rs | 1 + 3 files changed, 14 insertions(+) create mode 100644 default-streams/src/pos/nop.rs diff --git a/default-streams/src/pos/mod.rs b/default-streams/src/pos/mod.rs index b0a7887..5f41f3d 100644 --- a/default-streams/src/pos/mod.rs +++ b/default-streams/src/pos/mod.rs @@ -1,5 +1,6 @@ mod index; mod newline; +mod nop; pub use index::IndexPosCounter; pub use newline::PosLineCol; diff --git a/default-streams/src/pos/nop.rs b/default-streams/src/pos/nop.rs new file mode 100644 index 0000000..d8be3c8 --- /dev/null +++ b/default-streams/src/pos/nop.rs @@ -0,0 +1,12 @@ +use crate::iterator::PosCounter; +pub struct NopPosCounter {} + +impl PosCounter<'static, C, ()> for NopPosCounter { + fn update(&mut self, c: C) {} + + fn export(&self) {} + + fn init() -> Self { + return NopPosCounter {}; + } +} diff --git a/src/lib.rs b/src/lib.rs index 15fb1a2..e35b668 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,6 +6,7 @@ pub trait Predicate { pub trait Pos<'pos> {} +impl Pos<'static> for () {} impl Pos<'static> for usize {} pub trait KeywordComparatorIterator<'keyword, C> {