Trait thingvellir::upstreams::UpstreamSerializer
source · pub trait UpstreamSerializer<V>: Clone + Send + 'static {
type Error: Error + Send + 'static;
// Required methods
fn serialize(&self, value: &V) -> Result<Vec<u8>, Self::Error>;
fn deserialize(&self, buf: &[u8]) -> Result<V, Self::Error>;
}
Expand description
This trait is responsible for serializing and de-serializing data for the upstream, when
the upstream expects data to be stored as byte buffer (Vec<u8>
).
For example, an implementation of this exists, CborSerializer
that will serialize
the data for storage using the consistent binary object representation.
Required Associated Types§
Required Methods§
fn serialize(&self, value: &V) -> Result<Vec<u8>, Self::Error>
fn deserialize(&self, buf: &[u8]) -> Result<V, Self::Error>
Object Safety§
This trait is not object safe.