pub trait Serializer<T>: Send + Sync {
    // Required method
    fn serialize(&self, value: T) -> Result<Vec<u8>>;
}
Expand description

A serializer interface that can be used to serialize a Rust data type into a specific wire format as a byte array.

Required Methods§

source

fn serialize(&self, value: T) -> Result<Vec<u8>>

Serializes the given value into the protocol supported by this implementation.

§Errors

An error (anyhow::Error) is returned in case the serialization could not succeed as expected.

Implementors§

source§

impl<In, Out, S> Serializer<In> for Convert<In, Out, S>
where In: TryFrom<Out> + Send + Sync, Out: TryFrom<In> + Send + Sync, <Out as TryFrom<In>>::Error: Display, S: Serde<Out> + Send + Sync,

source§

impl<T> Serializer<T> for Json<T>
where for<'d> T: Serialize + Send + Sync + Deserialize<'d>,

source§

impl<T> Serializer<T> for ProtoJson<T>
where for<'de> T: Message + Serialize + Default + Deserialize<'de>,

source§

impl<T> Serializer<T> for Protobuf<T>
where T: Message + Default,