Skip to main content

ClientTaskEncode

Trait ClientTaskEncode 

Source
pub trait ClientTaskEncode {
    // Required method
    fn encode_req<C: Codec>(
        &self,
        codec: &C,
        buf: &mut Vec<u8>,
    ) -> Result<usize, ()>;

    // Provided method
    fn get_req_blob(&self) -> Option<&[u8]> { ... }
}
Expand description

Encode the request to buffer that can be send to server

Required Methods§

Source

fn encode_req<C: Codec>( &self, codec: &C, buf: &mut Vec<u8>, ) -> Result<usize, ()>

sererialized the msg into buf (with std::io::Writer), and return the size written

Provided Methods§

Source

fn get_req_blob(&self) -> Option<&[u8]>

Contain optional extra data to send to server side.

By Default, return None when client task does not have a req_blob field

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§