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§
Sourcefn serialize<T>(
&self,
value: &T,
context: &dyn Context,
) -> Result<Raw, FormatError>where
T: Cacheable,
fn serialize<T>(
&self,
value: &T,
context: &dyn Context,
) -> Result<Raw, FormatError>where
T: Cacheable,
Serializes a value to raw bytes.
Sourcefn deserialize<T>(
&self,
data: &Raw,
ctx: &mut BoxContext,
) -> Result<T, FormatError>where
T: Cacheable,
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.