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§
Provided Methods§
sourcefn encode_message<T: ToMessage<Self>>(
value: &T
) -> Result<(i32, Self::Body), Box<dyn Error + Send>>
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.
sourcefn decode_message<T: FromMessage<Self>>(
message: Message<Self::Body>
) -> Result<T, Error>
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.