Skip to main content

FormatExt

Trait FormatExt 

Source
pub trait FormatExt: Format {
    // Provided methods
    fn serialize<T>(
        &self,
        value: &T,
        context: &dyn Context,
    ) -> Result<Raw, FormatError>
       where T: Cacheable { ... }
    fn deserialize<T>(
        &self,
        data: &Raw,
        ctx: &mut BoxContext,
    ) -> Result<T, FormatError>
       where T: Cacheable { ... }
}
Expand description

Ergonomic serialization methods for Format.

Provides typed serialize and deserialize methods. This trait is automatically implemented for all Format types via blanket implementation.

Provided Methods§

Source

fn serialize<T>( &self, value: &T, context: &dyn Context, ) -> Result<Raw, FormatError>
where T: Cacheable,

Serializes a value to raw bytes.

Source

fn deserialize<T>( &self, data: &Raw, ctx: &mut BoxContext, ) -> Result<T, FormatError>
where T: Cacheable,

Deserializes raw bytes into a value.

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.

Implementors§

Source§

impl<T: Format + ?Sized> FormatExt for T