Trait fizyr_rpc::format::Format

source ·
pub trait Format {
    type Body: Body;

    // Provided methods
    fn encode_message<T: ToMessage<Self>>(
        value: &T
    ) -> Result<(i32, Self::Body), Box<dyn Error + Send>> { ... }
    fn decode_message<T: FromMessage<Self>>(
        message: Message<Self::Body>
    ) -> Result<T, Error> { ... }
}
Expand description

A message format, used to encode/decode RPC messages from/to Rust types.

Required Associated Types§

source

type Body: Body

The body type for the RPC messages.

Provided Methods§

source

fn encode_message<T: ToMessage<Self>>( value: &T ) -> Result<(i32, Self::Body), Box<dyn Error + Send>>

Encode a Rust value to a message.

This function must return the service ID and the message body as tuple if it succeeds.

source

fn decode_message<T: FromMessage<Self>>( message: Message<Self::Body> ) -> Result<T, Error>

Decode a message to a Rust value.

Object Safety§

This trait is not object safe.

Implementors§