pub struct StrInput<'a> { /* private fields */ }Expand description
A parser input that uses a &str as source.
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 buf_is_empty(&self) -> bool
fn buf_is_empty(&self) -> bool
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 next_char_is(&self, c: char) -> bool
fn next_char_is(&self, c: char) -> bool
c. Read more