DeserializerArtifact

Enum DeserializerArtifact 

Source
pub enum DeserializerArtifact<T>{
    None,
    Data(T),
    Deserializer(T::Deserializer),
}
Expand description

Artifact that is returned by a Deserializer.

This contains either the deserialized data or the deserializer itself.

Variants§

§

None

Is returned if the deserialization process is finished and not data was produced.

§

Data(T)

Contains the actual type constructed by the deserializer, once the deserializer has finished it’s construction.

§

Deserializer(T::Deserializer)

Contains the deserializer after an operation on the deserializer has been executed. This will be returned if the deserialization of the type is not finished yet.

Implementations§

Source§

impl<T> DeserializerArtifact<T>

Source

pub fn is_none(&self) -> bool

Check if this is a DeserializerArtifact::None.

Source

pub fn from_data(data: Option<T>) -> Self

Create a new DeserializerArtifact instance from the passed data.

If data is Some a DeserializerArtifact::Data is created. If it is a None a DeserializerArtifact::None is crated.

Source

pub fn from_deserializer(deserializer: Option<T::Deserializer>) -> Self

Create a new DeserializerArtifact instance from the passed deserializer.

If data is Some a DeserializerArtifact::Deserializer is created. If it is a None a DeserializerArtifact::None is crated.

Source

pub fn into_parts(self) -> (Option<T>, Option<T::Deserializer>)

Split the deserializer artifact into two options. One for the data and one for the deserializer.

Source

pub fn map<F, G, X>( self, data_mapper: F, deserializer_mapper: G, ) -> DeserializerArtifact<X>
where X: WithDeserializer, F: FnOnce(T) -> X, G: FnOnce(T::Deserializer) -> X::Deserializer,

Maps the data or the deserializer to new types using the passed mappers.

Trait Implementations§

Source§

impl<T> Debug for DeserializerArtifact<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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<X> AsAny for X
where X: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Get a reference to the current object as Any.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Get a mutable reference to the current object as Any.
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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,