Skip to main content

limbo_sqlite3_parser/parser/ast/
quotediterator_traits.rs

1//! # `QuotedIterator` - Trait Implementations
2//!
3//! This module contains trait implementations for `QuotedIterator`.
4//!
5//! ## Implemented Traits
6//!
7//! - `Iterator`
8//!
9//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
10
11use 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}