Skip to main content

MessageTranslator

Trait MessageTranslator 

Source
pub trait MessageTranslator<W, D>:
    Send
    + Sync
    + 'static {
    // Required methods
    fn serialize(&self, domain: &D) -> AppResult<W>;
    fn deserialize(&self, raw: &W) -> AppResult<D>;
}
Expand description

Translates messages between wire format and domain types.

W is the wire type carried inside Message<W> and D is the domain type the application works with.

Required Methods§

Source

fn serialize(&self, domain: &D) -> AppResult<W>

Serializes a domain type to wire format.

Source

fn deserialize(&self, raw: &W) -> AppResult<D>

Deserializes wire format to domain type.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§