pub struct Scanner<'de> { /* private fields */ }Implementations§
Source§impl<'de> Scanner<'de>
impl<'de> Scanner<'de>
pub fn new(input: &'de [u8]) -> Self
pub fn new_str(s: &'de str) -> Self
pub fn peek_byte(&self) -> Result<u8, Error>
pub fn advance(&mut self)
Sourcepub fn pos(&self) -> usize
pub fn pos(&self) -> usize
Byte offset into the input slice — used by internally-tagged enum parsers to checkpoint and re-scan.
pub fn set_pos(&mut self, saved_pos: usize)
pub fn advance_by(&mut self, n: usize)
Sourcepub fn remaining_input(&self) -> &'de [u8] ⓘ
pub fn remaining_input(&self) -> &'de [u8] ⓘ
Remaining unprocessed input — used by single-pass float parsers (fast_float2::parse_partial).
pub fn expect_byte(&mut self, expected: u8) -> Result<(), Error>
pub fn expect_bytes(&mut self, expected: &[u8]) -> Result<(), Error>
pub fn skip_whitespace(&mut self)
pub fn peek_byte_after_ws(&mut self) -> Result<u8, Error>
Sourcepub fn read_key(&mut self) -> Result<&'de [u8], Error>
pub fn read_key(&mut self) -> Result<&'de [u8], Error>
Read a JSON object key as a zero-copy &'de [u8].
Returns Error::EscapedKey if the key contains backslashes.
Sourcepub fn read_key_colon(&mut self) -> Result<&'de [u8], Error>
pub fn read_key_colon(&mut self) -> Result<&'de [u8], Error>
Read a JSON object key and the mandatory : separator in one call.
Sourcepub fn read_str(&mut self) -> Result<JsonStr<'de>, Error>
pub fn read_str(&mut self) -> Result<JsonStr<'de>, Error>
Read a JSON string value.
Returns Borrowed(&'de str) when no escape sequences are present
(zero allocation), or Owned(String) after unescaping.
Sourcepub fn read_number_bytes(&mut self) -> Result<&'de [u8], Error>
pub fn read_number_bytes(&mut self) -> Result<&'de [u8], Error>
Scan a JSON number and return the raw byte slice (zero-copy).
Sourcepub fn peek_null(&mut self) -> bool
pub fn peek_null(&mut self) -> bool
Returns true if the next (non-whitespace) bytes are null — does NOT consume.
pub fn read_null(&mut self) -> Result<(), Error>
pub fn read_bool(&mut self) -> Result<bool, Error>
Sourcepub fn skip_value(&mut self) -> Result<(), Error>
pub fn skip_value(&mut self) -> Result<(), Error>
Skip over any JSON value — used for unknown fields.
Sourcepub fn skip_object_tail(&mut self) -> Result<(), Error>
pub fn skip_object_tail(&mut self) -> Result<(), Error>
Skip remaining fields of an already-opened object (cursor is just past {).
Used by internally-tagged enum deserialization when the variant is unknown.