Skip to main content

ServerTaskEncode

Trait ServerTaskEncode 

Source
pub trait ServerTaskEncode: Send + 'static {
    // Required method
    fn encode_resp<'a, 'b, C: Codec>(
        &'a mut self,
        codec: &'b C,
        buf: &'b mut Vec<u8>,
    ) -> (u64, Result<(usize, Option<&'a [u8]>), EncodedErr>);
}
Expand description

How to encode a server response

For a server task with any type of buffer, user can always return u8 slice, so the framework don’t need to known the type, but this requires reference and lifetime to the task. for the returning EncodedErr, it’s possible generated during the encode, Otherwise when existing EncodedErr held in res field, the user need to take the res field out of the task.

Required Methods§

Source

fn encode_resp<'a, 'b, C: Codec>( &'a mut self, codec: &'b C, buf: &'b mut Vec<u8>, ) -> (u64, Result<(usize, Option<&'a [u8]>), EncodedErr>)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl ServerTaskEncode for RpcSvrResp

Source§

impl<T, M, E> ServerTaskEncode for ServerTaskVariant<T, M, E>
where T: Send + 'static, M: Serialize + Send + 'static, E: RpcErrCodec,

Source§

impl<T, R, P, E> ServerTaskEncode for ServerTaskVariantFull<T, R, P, E>
where T: Send + 'static, R: Send + 'static, P: Send + 'static + Serialize, E: RpcErrCodec,