pub trait Deserialized {
// Required method
fn map_de<T, U, F>(self, f: F) -> Result<U>
where F: FnOnce(T) -> U,
T: for<'de> Deserialize<'de>;
// Provided method
fn deserialized<T>(self) -> Result<T>
where T: for<'de> Deserialize<'de>,
Self: Sized { ... }
}Expand description
Converts a stored database value into a typed Serde value.
Implementations adapt pinned value handles and their result wrappers to the
database decoder. Use Deserialized::map_de to transform the decoded
value or Deserialized::deserialized to return it directly.
Required Methods§
Sourcefn map_de<T, U, F>(self, f: F) -> Result<U>where
F: FnOnce(T) -> U,
T: for<'de> Deserialize<'de>,
fn map_de<T, U, F>(self, f: F) -> Result<U>where
F: FnOnce(T) -> U,
T: for<'de> Deserialize<'de>,
Deserializes an intermediate value and maps it into the requested output.
The mapping closure runs only after successful deserialization. Any input or decoding error is returned without invoking the closure.
Provided Methods§
Sourcefn deserialized<T>(self) -> Result<T>where
T: for<'de> Deserialize<'de>,
Self: Sized,
fn deserialized<T>(self) -> Result<T>where
T: for<'de> Deserialize<'de>,
Self: Sized,
Deserializes the stored value directly into the requested type.
This is equivalent to mapping with the identity function. Any input or decoding error is returned unchanged.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".