limbo_sqlite3_parser/parser/ast/
quotediterator_traits.rs1use super::types_10::QuotedIterator;
12
13impl Iterator for QuotedIterator<'_> {
14 type Item = u8;
15
16 fn next(&mut self) -> Option<u8> {
17 match self.0.next() {
18 x @ Some(b) => {
19 if b == self.1 && self.0.next() != Some(self.1) {
20 panic!("Malformed string literal: {:?}", self.0);
21 }
22 x
23 }
24 x => x,
25 }
26 }
27
28 fn size_hint(&self) -> (usize, Option<usize>) {
29 if self.1 == 0 {
30 return self.0.size_hint();
31 }
32 (0, None)
33 }
34}