pub trait DistributedSerializer<V>: Send + Sync {
// Required methods
fn serialize(&self, entry: &DistributedEntry<V>) -> Result<Vec<u8>>;
fn deserialize(&self, bytes: &[u8]) -> Result<DistributedEntry<V>>;
}Expand description
Encodes and decodes DistributedEntry values for the wire.
This is object-safe (no generic methods), so a cache holds it as
Arc<dyn DistributedSerializer<V>> and the serialization format is fully
pluggable.
Required Methods§
Sourcefn deserialize(&self, bytes: &[u8]) -> Result<DistributedEntry<V>>
fn deserialize(&self, bytes: &[u8]) -> Result<DistributedEntry<V>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".