pub struct StreamParser<'b, R: Reader, C: BitStackConfig = DefaultConfig> { /* private fields */ }Expand description
A pull parser that parses JSON from a stream.
Generic over BitStackConfig for configurable nesting depth. It is designed to be used with the Reader trait, which is used to read data from a stream.
Implementations§
Source§impl<'b, R: Reader> StreamParser<'b, R, DefaultConfig>
Methods for StreamParser using DefaultConfig
impl<'b, R: Reader> StreamParser<'b, R, DefaultConfig>
Methods for StreamParser using DefaultConfig
Source§impl<'b, R: Reader, C: BitStackConfig> StreamParser<'b, R, C>
Methods for StreamParser with custom BitStackConfig
impl<'b, R: Reader, C: BitStackConfig> StreamParser<'b, R, C>
Methods for StreamParser with custom BitStackConfig
Sourcepub fn with_config(reader: R, buffer: &'b mut [u8]) -> Self
pub fn with_config(reader: R, buffer: &'b mut [u8]) -> Self
Create a new StreamParser with custom configuration
Use this when you need custom BitStack storage types for specific memory or nesting depth requirements.
§Example
use picojson::{StreamParser, BitStackStruct, ArrayBitStack};
let reader = JsonReader::new(json);
let mut buffer = [0u8; 256];
// Custom configuration: u64 bucket + u16 counter for deeper nesting
let mut parser = StreamParser::<_, BitStackStruct<u64, u16>>::with_config(reader, &mut buffer);Trait Implementations§
Source§impl<'b, R: Reader, C: BitStackConfig> PullParser for StreamParser<'b, R, C>
impl<'b, R: Reader, C: BitStackConfig> PullParser for StreamParser<'b, R, C>
Source§fn next_event(&mut self) -> Result<Event<'_, '_>, ParseError>
fn next_event(&mut self) -> Result<Event<'_, '_>, ParseError>
Returns the next JSON event or an error if parsing fails.
Parsing continues until
EndDocument is returned or an error occurs.Auto Trait Implementations§
impl<'b, R, C> Freeze for StreamParser<'b, R, C>
impl<'b, R, C> RefUnwindSafe for StreamParser<'b, R, C>where
R: RefUnwindSafe,
<C as BitStackConfig>::Counter: RefUnwindSafe,
<C as BitStackConfig>::Bucket: RefUnwindSafe,
impl<'b, R, C> Send for StreamParser<'b, R, C>
impl<'b, R, C> Sync for StreamParser<'b, R, C>
impl<'b, R, C> Unpin for StreamParser<'b, R, C>
impl<'b, R, C = DefaultConfig> !UnwindSafe for StreamParser<'b, R, C>
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