pub struct BufferedInput<T: Iterator<Item = char>> { /* private fields */ }
Expand description
A wrapper around an Iterator
of char
s with a buffer.
The YAML scanner often needs some lookahead. With fully allocated buffers such as String
or
&str
, this is not an issue. However, with streams, we need to have a way of peeking multiple
characters at a time and sometimes pushing some back into the stream.
There is no “easy” way of doing this without itertools. In order to avoid pulling the entierty
of itertools for one method, we use this structure.
Implementations§
Source§impl<T: Iterator<Item = char>> BufferedInput<T>
impl<T: Iterator<Item = char>> BufferedInput<T>
Sourcepub fn new(input: T) -> Self
pub fn new(input: T) -> Self
Create a new BufferedInput
with the given input.
Trait Implementations§
Source§impl<T: Iterator<Item = char>> Input for BufferedInput<T>
impl<T: Iterator<Item = char>> Input for BufferedInput<T>
Source§fn lookahead(&mut self, count: usize)
fn lookahead(&mut self, count: usize)
A hint to the input source that we will need to read
count
characters. Read moreSource§fn raw_read_ch(&mut self) -> char
fn raw_read_ch(&mut self) -> char
Read a character from the input stream and return it directly. Read more
Source§fn raw_read_non_breakz_ch(&mut self) -> Option<char>
fn raw_read_non_breakz_ch(&mut self) -> Option<char>
Read a non-breakz a character from the input stream and return it directly. Read more
Source§fn peek_nth(&self, n: usize) -> char
fn peek_nth(&self, n: usize) -> char
Return the
n
-th character in the buffer, without consuming it. Read moreSource§fn buf_is_empty(&self) -> bool
fn buf_is_empty(&self) -> bool
Return whether the buffer (!= stream) is empty.
Source§fn next_char_is(&self, c: char) -> bool
fn next_char_is(&self, c: char) -> bool
Return whether the next character in the input source is equal to
c
. Read moreSource§fn next_2_are(&self, c1: char, c2: char) -> bool
fn next_2_are(&self, c1: char, c2: char) -> bool
Return whether the next 2 characters in the input source match the given characters. Read more
Source§fn next_3_are(&self, c1: char, c2: char, c3: char) -> bool
fn next_3_are(&self, c1: char, c2: char, c3: char) -> bool
Return whether the next 3 characters in the input source match the given characters. Read more
Source§fn next_is_document_indicator(&self) -> bool
fn next_is_document_indicator(&self) -> bool
Check whether the next characters correspond to a document indicator. Read more
Source§fn next_is_document_start(&self) -> bool
fn next_is_document_start(&self) -> bool
Check whether the next characters correspond to a start of document. Read more
Source§fn next_is_document_end(&self) -> bool
fn next_is_document_end(&self) -> bool
Check whether the next characters correspond to an end of document. Read more
Source§fn skip_ws_to_eol(
&mut self,
skip_tabs: SkipTabs,
) -> (usize, Result<SkipTabs, &'static str>)
fn skip_ws_to_eol( &mut self, skip_tabs: SkipTabs, ) -> (usize, Result<SkipTabs, &'static str>)
Skip yaml whitespace at most up to eol. Also skips comments. Advances the input. Read more
Source§fn next_can_be_plain_scalar(&self, in_flow: bool) -> bool
fn next_can_be_plain_scalar(&self, in_flow: bool) -> bool
Check whether the next characters may be part of a plain scalar. Read more
Source§fn next_is_blank_or_break(&self) -> bool
fn next_is_blank_or_break(&self) -> bool
Source§fn next_is_blank_or_breakz(&self) -> bool
fn next_is_blank_or_breakz(&self) -> bool
Source§fn skip_while_non_breakz(&mut self) -> usize
fn skip_while_non_breakz(&mut self) -> usize
Source§fn skip_while_blank(&mut self) -> usize
fn skip_while_blank(&mut self) -> usize
Auto Trait Implementations§
impl<T> Freeze for BufferedInput<T>where
T: Freeze,
impl<T> RefUnwindSafe for BufferedInput<T>where
T: RefUnwindSafe,
impl<T> Send for BufferedInput<T>where
T: Send,
impl<T> Sync for BufferedInput<T>where
T: Sync,
impl<T> Unpin for BufferedInput<T>where
T: Unpin,
impl<T> UnwindSafe for BufferedInput<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more