PushParser

Struct PushParser 

Source
pub struct PushParser<'input, 'scratch, H, C>
where C: BitStackConfig,
{ /* private fields */ }
Expand description

A SAX-style JSON push parser.

Generic over BitStack storage type for configurable nesting depth. Parsing events are returned to the handler.

§Generic Parameters

  • 'scratch - Lifetime for the scratch buffer used for temporary storage
  • H - The event handler type that implements PushParserHandler
  • C - BitStack configuration type that implements BitStackConfig

Implementations§

Source§

impl<'input, 'scratch, H, C> PushParser<'input, 'scratch, H, C>
where C: BitStackConfig,

Source

pub fn new(handler: H, buffer: &'scratch mut [u8]) -> Self

Creates a new PushParser.

Source

pub fn write<E>(&mut self, data: &'input [u8]) -> Result<(), PushParseError<E>>
where H: for<'a, 'b> PushParserHandler<'a, 'b, E>, E: From<ParseError>,

Processes a chunk of input data.

Source

pub fn finish<E>(self) -> Result<H, PushParseError<E>>
where H: for<'a, 'b> PushParserHandler<'a, 'b, E>,

Finishes parsing, flushes any remaining events, and returns the handler. This method consumes the parser.

Auto Trait Implementations§

§

impl<'input, 'scratch, H, C> Freeze for PushParser<'input, 'scratch, H, C>

§

impl<'input, 'scratch, H, C> RefUnwindSafe for PushParser<'input, 'scratch, H, C>

§

impl<'input, 'scratch, H, C> Send for PushParser<'input, 'scratch, H, C>
where H: Send, <C as BitStackConfig>::Counter: Send, <C as BitStackConfig>::Bucket: Send,

§

impl<'input, 'scratch, H, C> Sync for PushParser<'input, 'scratch, H, C>
where H: Sync, <C as BitStackConfig>::Counter: Sync, <C as BitStackConfig>::Bucket: Sync,

§

impl<'input, 'scratch, H, C> Unpin for PushParser<'input, 'scratch, H, C>

§

impl<'input, 'scratch, H, C> !UnwindSafe for PushParser<'input, 'scratch, H, C>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.