Function send_request

pub async fn send_request<C, B>(
    send: &mut SendStream,
    buf: &mut Vec<u8>,
    code: C,
    body: B,
) -> Result<(), Error>
where C: Into<u32>, B: Serialize,
Expand description

Sends a request with a big-endian 4-byte length header.

buf will be cleared after the response is sent.

ยงErrors

Returns std::io::ErrorKind::InvalidData if the message is too large, or other errors if the message could not be written to the stream.