[][src]Trait parsec_interface::operations::Convert

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

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

Required methods

pub fn body_type(&self) -> BodyType[src]

Get the BodyType associated with this converter.

pub fn body_to_operation(
    &self,
    body: RequestBody,
    opcode: Opcode
) -> Result<NativeOperation>
[src]

Create a native operation object from a request body.

Errors

  • if deserialization fails, ResponseStatus::DeserializingBodyFailed is returned

pub fn operation_to_body(
    &self,
    operation: NativeOperation
) -> Result<RequestBody>
[src]

Create a request body from a native operation object.

Errors

  • if serialization fails, ResponseStatus::SerializingBodyFailed is returned

pub fn body_to_result(
    &self,
    body: ResponseBody,
    opcode: Opcode
) -> Result<NativeResult>
[src]

Create a native result object from a response body.

Errors

  • if deserialization fails, ResponseStatus::DeserializingBodyFailed is returned

pub fn result_to_body(&self, result: NativeResult) -> Result<ResponseBody>[src]

Create a response body from a native result object.

Errors

  • if serialization fails, ResponseStatus::SerializingBodyFailed is returned
Loading content...

Implementors

impl Convert for ProtobufConverter[src]

Loading content...