pub trait ServerTaskEncode:
Send
+ 'static
+ Unpin {
// 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§
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.