Skip to main content

PayloadCodec

Trait PayloadCodec 

Source
pub trait PayloadCodec {
    // Required methods
    fn encode(
        &self,
        context: &SerializationContextData,
        payloads: Vec<Payload>,
    ) -> Pin<Box<dyn Future<Output = Vec<Payload>> + Send>>;
    fn decode(
        &self,
        context: &SerializationContextData,
        payloads: Vec<Payload>,
    ) -> Pin<Box<dyn Future<Output = Vec<Payload>> + Send>>;
}
Expand description

Encodes and decodes payloads, enabling encryption or compression.

Required Methods§

Source

fn encode( &self, context: &SerializationContextData, payloads: Vec<Payload>, ) -> Pin<Box<dyn Future<Output = Vec<Payload>> + Send>>

Encode payloads before they are sent to the server.

Source

fn decode( &self, context: &SerializationContextData, payloads: Vec<Payload>, ) -> Pin<Box<dyn Future<Output = Vec<Payload>> + Send>>

Decode payloads after they are received from the server.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> PayloadCodec for Arc<T>
where T: PayloadCodec,

Source§

fn encode( &self, context: &SerializationContextData, payloads: Vec<Payload>, ) -> Pin<Box<dyn Future<Output = Vec<Payload>> + Send>>

Source§

fn decode( &self, context: &SerializationContextData, payloads: Vec<Payload>, ) -> Pin<Box<dyn Future<Output = Vec<Payload>> + Send>>

Implementors§