pub trait Convert {
    fn body_type(&self) -> BodyType;
fn body_to_operation(
        &self,
        body: RequestBody,
        opcode: Opcode
    ) -> Result<NativeOperation>;
fn operation_to_body(
        &self,
        operation: NativeOperation
    ) -> Result<RequestBody>;
fn body_to_result(
        &self,
        body: ResponseBody,
        opcode: Opcode
    ) -> Result<NativeResult>;
fn result_to_body(&self, result: NativeResult) -> Result<ResponseBody>; }
Expand description

Definition of the operations converters must implement to allow usage of a specific BodyType.

Required methods

Get the BodyType associated with this converter.

Create a native operation object from a request body.

Errors
  • if deserialization fails, ResponseStatus::DeserializingBodyFailed is returned

Create a request body from a native operation object.

Errors
  • if serialization fails, ResponseStatus::SerializingBodyFailed is returned

Create a native result object from a response body.

Errors
  • if deserialization fails, ResponseStatus::DeserializingBodyFailed is returned

Create a response body from a native result object.

Errors
  • if serialization fails, ResponseStatus::SerializingBodyFailed is returned

Implementors