Struct serde_json::de::SliceRead
source · pub struct SliceRead<'a> {
slice: &'a [u8],
index: usize,
}
Expand description
JSON input source that reads from a slice of bytes.
Fields§
§slice: &'a [u8]
§index: usize
Index of the next byte that will be returned by next() or peek().
Implementations§
source§impl<'a> SliceRead<'a>
impl<'a> SliceRead<'a>
fn position_of_index(&self, i: usize) -> Position
fn skip_to_escape(&mut self, forbid_control_characters: bool)
fn skip_to_escape_slow(&mut self)
sourcefn parse_str_bytes<'s, T, F>(
&'s mut self,
scratch: &'s mut Vec<u8>,
validate: bool,
result: F,
) -> Result<Reference<'a, 's, T>>
fn parse_str_bytes<'s, T, F>( &'s mut self, scratch: &'s mut Vec<u8>, validate: bool, result: F, ) -> Result<Reference<'a, 's, T>>
The big optimization here over IoRead is that if the string contains no backslash escape sequences, the returned &str is a slice of the raw JSON data so we avoid copying into the scratch space.
Trait Implementations§
impl<'a> Fused for SliceRead<'a>
impl<'a> Read<'a> for SliceRead<'a>
impl<'a> Sealed for SliceRead<'a>
Auto Trait Implementations§
impl<'a> Freeze for SliceRead<'a>
impl<'a> RefUnwindSafe for SliceRead<'a>
impl<'a> Send for SliceRead<'a>
impl<'a> Sync for SliceRead<'a>
impl<'a> Unpin for SliceRead<'a>
impl<'a> UnwindSafe for SliceRead<'a>
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