pub enum DeserializerArtifact<T>where
T: WithDeserializer,{
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>where
T: WithDeserializer,
impl<T> DeserializerArtifact<T>where
T: WithDeserializer,
Sourcepub fn is_none(&self) -> bool
pub fn is_none(&self) -> bool
Check if this is a DeserializerArtifact::None
.
Sourcepub fn from_data(data: Option<T>) -> Self
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.
Sourcepub fn from_deserializer(deserializer: Option<T::Deserializer>) -> Self
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.
Sourcepub fn into_parts(self) -> (Option<T>, Option<T::Deserializer>)
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.
Sourcepub fn map<F, G, X>(
self,
data_mapper: F,
deserializer_mapper: G,
) -> DeserializerArtifact<X>
pub fn map<F, G, X>( self, data_mapper: F, deserializer_mapper: G, ) -> DeserializerArtifact<X>
Maps the data or the deserializer to new types using the passed mappers.