Trait json_threat_protection::read::Read
source · pub trait Read {
// Required methods
fn position(&self) -> Position;
fn peek(&mut self) -> Result<Option<u8>, ReadError>;
fn next(&mut self) -> Result<Option<u8>, ReadError>;
// Provided methods
fn discard(&mut self) { ... }
fn next4(&mut self) -> Result<[u8; 4], ReadError> { ... }
fn next5(&mut self) -> Result<[u8; 5], ReadError> { ... }
fn skip_whitespace(&mut self) -> Result<(), ReadError> { ... }
fn next_number(&mut self) -> Result<(), ReadError> { ... }
fn next_likely_string(&mut self, buf: &mut Vec<u8>) -> Result<(), ReadError> { ... }
}Expand description
A trait for reading characters from a source.
§Performance
All provided methods might not be the most efficient way to read characters
as it might return the ReadError, which basically an std::io::Error.
However, reading characters from in memory source should raise std::io::Error,
so you could implement your own Read trait and its provided methods
for better performance, such as SliceRead.
Required Methods§
Provided Methods§
sourcefn skip_whitespace(&mut self) -> Result<(), ReadError>
fn skip_whitespace(&mut self) -> Result<(), ReadError>
Skip whitespace characters (' ', '\t', '\n', '\r').
sourcefn next_number(&mut self) -> Result<(), ReadError>
fn next_number(&mut self) -> Result<(), ReadError>
Parse a number and allow arbitrary precision.