use std::marker::PhantomData; use crate::pos::{PosCounter}; use crate::{CollectedSubstring, Predicate, SourceStream}; pub struct EmptySourceStream, PC: PosCounter> { _pos: PC, __phantom: PhantomData<(C, CS)> } impl, PC: PosCounter> EmptySourceStream { pub fn start(pos: PC) -> (Self, Option) { let stream = EmptySourceStream { _pos: pos, __phantom: PhantomData::default() }; return (stream, None); } } impl, PC: PosCounter> SourceStream for EmptySourceStream { type C = C; type P = PC::P; type CS = CS; fn skipNext(&mut self, _: &mut impl Predicate) -> Option { return None; } fn collect(&mut self, _: &mut impl Predicate) -> (Self::CS, Option) { panic!("How about to check first char of substring being collected first"); } fn pos(&self) -> Self::P { return self._pos.export(); } fn nextChar(&mut self) -> Option { return None; } }