FormatDeserializer

Struct FormatDeserializer 

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

Generic deserializer that drives a format-specific parser directly into Partial.

The const generic BORROW controls whether string data can be borrowed:

  • BORROW=true: strings without escapes are borrowed from input
  • BORROW=false: all strings are owned

Implementations§

Source§

impl<'input, P> FormatDeserializer<'input, true, P>

Source

pub const fn new(parser: P) -> Self

Create a new deserializer that can borrow strings from input.

Source§

impl<'input, P> FormatDeserializer<'input, false, P>

Source

pub const fn new_owned(parser: P) -> Self

Create a new deserializer that produces owned strings.

Source§

impl<'input, const BORROW: bool, P> FormatDeserializer<'input, BORROW, P>

Source

pub fn into_inner(self) -> P

Consume the facade and return the underlying parser.

Source

pub fn parser_mut(&mut self) -> &mut P

Borrow the inner parser mutably.

Source§

impl<'input, P> FormatDeserializer<'input, true, P>
where P: FormatParser<'input>,

Source

pub fn deserialize<T>(&mut self) -> Result<T, DeserializeError<P::Error>>
where T: Facet<'input>,

Deserialize the next value in the stream into T, allowing borrowed strings.

Source

pub fn deserialize_root<T>(&mut self) -> Result<T, DeserializeError<P::Error>>
where T: Facet<'input>,

Deserialize the next value in the stream into T (for backward compatibility).

Source§

impl<'input, P> FormatDeserializer<'input, false, P>
where P: FormatParser<'input>,

Source

pub fn deserialize<T>(&mut self) -> Result<T, DeserializeError<P::Error>>
where T: Facet<'static>,

Deserialize the next value in the stream into T, using owned strings.

Source

pub fn deserialize_root<T>(&mut self) -> Result<T, DeserializeError<P::Error>>
where T: Facet<'static>,

Deserialize the next value in the stream into T (for backward compatibility).

Source§

impl<'input, const BORROW: bool, P> FormatDeserializer<'input, BORROW, P>
where P: FormatParser<'input>,

Source

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

Main deserialization entry point - deserialize into a Partial.

Auto Trait Implementations§

§

impl<'input, const BORROW: bool, P> Freeze for FormatDeserializer<'input, BORROW, P>
where P: Freeze,

§

impl<'input, const BORROW: bool, P> RefUnwindSafe for FormatDeserializer<'input, BORROW, P>
where P: RefUnwindSafe,

§

impl<'input, const BORROW: bool, P> Send for FormatDeserializer<'input, BORROW, P>
where P: Send,

§

impl<'input, const BORROW: bool, P> Sync for FormatDeserializer<'input, BORROW, P>
where P: Sync,

§

impl<'input, const BORROW: bool, P> Unpin for FormatDeserializer<'input, BORROW, P>
where P: Unpin,

§

impl<'input, const BORROW: bool, P> UnwindSafe for FormatDeserializer<'input, BORROW, P>
where P: 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.