pub trait DeserializationState<'de>: Default {
type Value: DeserializationError;
// Required methods
fn is_param_known(&self, key: &str) -> bool;
fn deserialize_temp(
&mut self,
key: &str,
value: Param<'_>,
) -> Result<ParamKind, <Self::Value as DeserializationError>::Error>;
fn finalize(
self,
) -> Result<Self::Value, <Self::Value as DeserializationError>::Error>;
// Provided method
fn deserialize_borrowed(
&mut self,
key: &'de str,
value: Param<'de>,
) -> Result<ParamKind, <Self::Value as DeserializationError>::Error> { ... }
}Expand description
Represents the state of deserialization of extras.
Required Associated Types§
Sourcetype Value: DeserializationError
type Value: DeserializationError
Value returned when deserialization finishes.
Required Methods§
Sourcefn is_param_known(&self, key: &str) -> bool
fn is_param_known(&self, key: &str) -> bool
Returns true if the parameter is known.
Required parameters include the req- prefix.
Sourcefn deserialize_temp(
&mut self,
key: &str,
value: Param<'_>,
) -> Result<ParamKind, <Self::Value as DeserializationError>::Error>
fn deserialize_temp( &mut self, key: &str, value: Param<'_>, ) -> Result<ParamKind, <Self::Value as DeserializationError>::Error>
Deserializes a temporary.
This can not borrow the key nor value, so has to clone them or throw away.
Required parameters include the req- prefix.
Provided Methods§
Sourcefn deserialize_borrowed(
&mut self,
key: &'de str,
value: Param<'de>,
) -> Result<ParamKind, <Self::Value as DeserializationError>::Error>
fn deserialize_borrowed( &mut self, key: &'de str, value: Param<'de>, ) -> Result<ParamKind, <Self::Value as DeserializationError>::Error>
Deserializes a borrowed value possibly avoiding cloning.
Implementing this can enable zero-copy deserialization.
Required parameters include the req- prefix.
The default implementation forwards to deserialize_temp
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.