pub struct FromReadJsonReader<R: Read> { /* private fields */ }
Expand description
Parses a JSON file from a Read
implementation.
use json_event_parser::{FromReadJsonReader, JsonEvent};
let mut reader = FromReadJsonReader::new(b"{\"foo\": 1}".as_slice());
assert_eq!(reader.read_next_event()?, JsonEvent::StartObject);
assert_eq!(reader.read_next_event()?, JsonEvent::ObjectKey("foo".into()));
assert_eq!(reader.read_next_event()?, JsonEvent::Number("1".into()));
assert_eq!(reader.read_next_event()?, JsonEvent::EndObject);
assert_eq!(reader.read_next_event()?, JsonEvent::Eof);
Implementations§
Source§impl<R: Read> FromReadJsonReader<R>
impl<R: Read> FromReadJsonReader<R>
pub const fn new(read: R) -> Self
Sourcepub fn with_max_buffer_size(self, size: usize) -> Self
pub fn with_max_buffer_size(self, size: usize) -> Self
Sets the max size of the internal buffer in bytes
pub fn read_next_event(&mut self) -> Result<JsonEvent<'_>, ParseError>
Auto Trait Implementations§
impl<R> Freeze for FromReadJsonReader<R>where
R: Freeze,
impl<R> RefUnwindSafe for FromReadJsonReader<R>where
R: RefUnwindSafe,
impl<R> Send for FromReadJsonReader<R>where
R: Send,
impl<R> Sync for FromReadJsonReader<R>where
R: Sync,
impl<R> Unpin for FromReadJsonReader<R>where
R: Unpin,
impl<R> UnwindSafe for FromReadJsonReader<R>where
R: UnwindSafe,
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