pub struct StrInput<'a> { /* private fields */ }Expand description
A parser input backed by a &str.
Implementations§
Trait Implementations§
Source§impl<'a> BorrowedInput<'a> for StrInput<'a>
impl<'a> BorrowedInput<'a> for StrInput<'a>
Source§impl Input for StrInput<'_>
impl Input for StrInput<'_>
Source§fn next_is_alpha(&self) -> bool
fn next_is_alpha(&self) -> bool
Check if the next character is an ASCII alphanumeric, _, or -.
This is used as a heuristic for error detection (e.g., when : is followed
by tab and then a potential value character). The ASCII-only check is intentional:
it catches common cases like key:\tvalue while avoiding false positives for
valid YAML constructs. Unicode value starters (e.g., äöü) are not detected,
but such cases will still fail to parse (with a less specific error message).
Source§fn fetch_while_is_alpha(&mut self, out: &mut String) -> usize
fn fetch_while_is_alpha(&mut self, out: &mut String) -> usize
Fetch characters matching is_alpha (ASCII alphanumeric, _, -).
This is used for scanning tag handles (e.g., !foo!). Per YAML 1.2 spec,
tag handles use ns-word-char which is [0-9a-zA-Z-]. Our implementation
is slightly more permissive by also accepting _, but this is harmless
and matches common practice. Unicode characters like ä or π are NOT
valid in tag handles per spec, so the ASCII-only byte-based scanning here
is both correct and efficient.
Source§fn lookahead(&mut self, x: usize)
fn lookahead(&mut self, x: usize)
count characters. Read moreSource§fn buflen(&self) -> usize
fn buflen(&self) -> usize
Source§fn bufmaxlen(&self) -> usize
fn bufmaxlen(&self) -> usize
Source§fn raw_read_ch(&mut self) -> char
fn raw_read_ch(&mut self) -> char
Source§fn raw_read_non_breakz_ch(&mut self) -> Option<char>
fn raw_read_non_breakz_ch(&mut self) -> Option<char>
Source§fn peek_nth(&self, n: usize) -> char
fn peek_nth(&self, n: usize) -> char
n-th character in the buffer, without consuming it. Read moreSource§fn byte_offset(&self) -> Option<usize>
fn byte_offset(&self) -> Option<usize>
Source§fn slice_bytes(&self, start: usize, end: usize) -> Option<&str>
fn slice_bytes(&self, start: usize, end: usize) -> Option<&str>
Source§fn may_contain_comments(&self) -> bool
fn may_contain_comments(&self) -> bool
# character. Read moreSource§fn next_2_are(&self, c1: char, c2: char) -> bool
fn next_2_are(&self, c1: char, c2: char) -> bool
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
Source§fn next_is_document_indicator(&self) -> bool
fn next_is_document_indicator(&self) -> bool
Source§fn next_is_document_start(&self) -> bool
fn next_is_document_start(&self) -> bool
Source§fn next_is_document_end(&self) -> bool
fn next_is_document_end(&self) -> bool
Source§fn skip_ws_to_eol(
&mut self,
skip_tabs: SkipTabs,
) -> (usize, Result<SkipTabs, ErrorKind>)
fn skip_ws_to_eol( &mut self, skip_tabs: SkipTabs, ) -> (usize, Result<SkipTabs, ErrorKind>)
Source§fn skip_ws_to_eol_blanks(&mut self, skip_tabs: SkipTabs) -> (usize, SkipTabs)
fn skip_ws_to_eol_blanks(&mut self, skip_tabs: SkipTabs) -> (usize, SkipTabs)
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
Source§fn fetch_while_is_yaml_non_space(&mut self, out: &mut String) -> usize
fn fetch_while_is_yaml_non_space(&mut self, out: &mut String) -> usize
is_yaml_non_space(c). Read moreSource§fn fetch_plain_scalar_chunk(
&mut self,
out: &mut String,
_count: usize,
flow_level_gt_0: bool,
) -> (bool, usize)
fn fetch_plain_scalar_chunk( &mut self, out: &mut String, _count: usize, flow_level_gt_0: bool, ) -> (bool, usize)
Source§fn skip_plain_scalar_chunk(
&mut self,
_count: usize,
flow_level_gt_0: bool,
) -> (bool, usize)
fn skip_plain_scalar_chunk( &mut self, _count: usize, flow_level_gt_0: bool, ) -> (bool, usize)
Source§fn buf_is_empty(&self) -> bool
fn buf_is_empty(&self) -> bool
Source§fn take_source_error(&mut self) -> Option<ErrorKind>
fn take_source_error(&mut self) -> Option<ErrorKind>
Source§fn next_char_is(&self, c: char) -> bool
fn next_char_is(&self, c: char) -> bool
c. Read more