JsonDeserializer

Struct JsonDeserializer 

Source
pub struct JsonDeserializer<'input, const BORROW: bool, A: TokenSource<'input>> { /* private fields */ }
Expand description

JSON deserializer using recursive descent.

Generic over a token source A which must implement TokenSource<'input>. The const generic BORROW controls whether string data can be borrowed:

  • BORROW=true: strings without escapes are borrowed from input (for slice-based parsing)
  • BORROW=false: all strings are owned (for streaming or owned output)

For slice-based parsing, use SliceAdapter<'input, BORROW>. For streaming parsing, use StreamingAdapter with BORROW=false.

Implementations§

Source§

impl<'input> JsonDeserializer<'input, true, SliceAdapter<'input, true>>

Source

pub fn new(input: &'input [u8]) -> Self

Create a new deserializer for the given input. Strings without escapes will be borrowed from input.

Source§

impl<'input> JsonDeserializer<'input, false, SliceAdapter<'input, false>>

Source

pub fn new_owned(input: &'input [u8]) -> Self

Create a new deserializer that produces owned strings. Use this when deserializing into owned types from temporary buffers.

Source§

impl<'input, const BORROW: bool, A: TokenSource<'input>> JsonDeserializer<'input, BORROW, A>

Source

pub fn from_adapter(adapter: A) -> Self

Create a deserializer from an existing adapter.

Source

pub fn deserialize_into( &mut self, wip: Partial<'input, BORROW>, ) -> Result<Partial<'input, BORROW>, JsonError>

Main deserialization entry point - deserialize into a Partial.

Auto Trait Implementations§

§

impl<'input, const BORROW: bool, A> Freeze for JsonDeserializer<'input, BORROW, A>
where A: Freeze,

§

impl<'input, const BORROW: bool, A> RefUnwindSafe for JsonDeserializer<'input, BORROW, A>
where A: RefUnwindSafe,

§

impl<'input, const BORROW: bool, A> Send for JsonDeserializer<'input, BORROW, A>
where A: Send,

§

impl<'input, const BORROW: bool, A> Sync for JsonDeserializer<'input, BORROW, A>
where A: Sync,

§

impl<'input, const BORROW: bool, A> Unpin for JsonDeserializer<'input, BORROW, A>
where A: Unpin,

§

impl<'input, const BORROW: bool, A> UnwindSafe for JsonDeserializer<'input, BORROW, A>
where A: UnwindSafe,

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.