Skip to main content

Deserialized

Trait Deserialized 

Source
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§

Source

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§

Source

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".

Implementations on Foreign Types§

Source§

impl Deserialized for Result<Handle<'_>>

Source§

fn map_de<T, U, F>(self, f: F) -> Result<U>
where F: FnOnce(T) -> U, T: for<'de> Deserialize<'de>,

Source§

impl<'a> Deserialized for Result<&'a Handle<'a>>

Source§

fn map_de<T, U, F>(self, f: F) -> Result<U>
where F: FnOnce(T) -> U, T: for<'de> Deserialize<'de>,

Implementors§

Source§

impl<'a> Deserialized for &'a Handle<'a>