Function dialectic_tokio_serde_bincode::length_delimited [−][src]
pub fn length_delimited<W: AsyncWrite, R: AsyncRead>(
writer: W,
reader: R,
length_field_bytes: usize,
max_length: usize
) -> (Sender<Bincode, LengthDelimitedCodec, W>, Receiver<Bincode, LengthDelimitedCodec, R>)
Pairs the Bincode
serialization format with the
LengthDelimitedCodec
for framing, returning a
symmetrical pair of Sender
and Receiver
.
The length_field_bytes
parameter indicates how many bytes to use for representing the length
of each frame on the wire, and must range between 1 and 8, inclusive.
The max_length
parameter indicates the maximum length of any message received or sent. An
error is thrown during encoding and decoding if a message would exceed this length.