pub trait DeserializeVersioned<'de, VM: VersionMap>: Deserialize<'de> {
// Required methods
fn deserialize_versioned<D>(
deserializer: D,
_version_map: VM,
) -> Result<Self, Error<D::Error>>
where D: Deserializer<'de>;
fn next_element<S>(
seq_access: &mut S,
version_map: VM,
) -> Result<Option<Self>, Error<S::Error>>
where S: SeqAccess<'de>;
fn next_value<M>(
map_access: &mut M,
_version_map: VM,
) -> Result<Self, Error<M::Error>>
where M: MapAccess<'de>;
fn next_key<M>(
map_access: &mut M,
_version_map: VM,
) -> Result<Option<Self>, Error<M::Error>>
where M: MapAccess<'de>;
fn variant<E>(
enum_access: E,
_version_map: VM,
) -> Result<(Self, E::Variant), Error<E::Error>>
where E: EnumAccess<'de>;
}Expand description
Trait for versioning support during deserialization
Use the derive feature to generate the implementation from #[derive(DeserializeVersioned)]
and #[versions(...)] attribute.
Required Methods§
Sourcefn deserialize_versioned<D>(
deserializer: D,
_version_map: VM,
) -> Result<Self, Error<D::Error>>where
D: Deserializer<'de>,
fn deserialize_versioned<D>(
deserializer: D,
_version_map: VM,
) -> Result<Self, Error<D::Error>>where
D: Deserializer<'de>,
Entry point for the versioned deserialization
Implement this method to specialize the deserialization for a particular type.
The default implementation ignore the versioning
Note: The VM type should be a reference type for better performance.
The version_map is cloned during the deserialization process, but cloning a reference
is cheap.
Sourcefn next_element<S>(
seq_access: &mut S,
version_map: VM,
) -> Result<Option<Self>, Error<S::Error>>where
S: SeqAccess<'de>,
fn next_element<S>(
seq_access: &mut S,
version_map: VM,
) -> Result<Option<Self>, Error<S::Error>>where
S: SeqAccess<'de>,
Entry point for deserializing an element in a sequence
Implement this method to specialize the deserialization for a particular type.
The default implementation ignore the versioning
Sourcefn next_value<M>(
map_access: &mut M,
_version_map: VM,
) -> Result<Self, Error<M::Error>>where
M: MapAccess<'de>,
fn next_value<M>(
map_access: &mut M,
_version_map: VM,
) -> Result<Self, Error<M::Error>>where
M: MapAccess<'de>,
Entry point for deserializing the next map value
Implement this method to specialize the deserialization for a particular type.
The default implementation ignore the versioning
Sourcefn next_key<M>(
map_access: &mut M,
_version_map: VM,
) -> Result<Option<Self>, Error<M::Error>>where
M: MapAccess<'de>,
fn next_key<M>(
map_access: &mut M,
_version_map: VM,
) -> Result<Option<Self>, Error<M::Error>>where
M: MapAccess<'de>,
Entry point for deserializing the next key value
Implement this method to specialize the deserialization for a particular type.
The default implementation ignore the versioning
Sourcefn variant<E>(
enum_access: E,
_version_map: VM,
) -> Result<(Self, E::Variant), Error<E::Error>>where
E: EnumAccess<'de>,
fn variant<E>(
enum_access: E,
_version_map: VM,
) -> Result<(Self, E::Variant), Error<E::Error>>where
E: EnumAccess<'de>,
Entry point for deserializing the next variant
Implement this method to specialize the deserialization for a particular type.
The default implementation ignore the versioning
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.