Function packet_stream::packet_stream [] [src]

pub fn packet_stream<R: AsyncRead, W: AsyncWrite, B: AsRef<[u8]>>(
    r: R,
    w: W
) -> (PsIn<R, W, B>, PsOut<R, W, B>)

Take ownership of an AsyncRead and an AsyncWrite to create the two halves of a packet-stream.

R is the AsyncRead for reading bytes from the peer, W is the AsyncWrite for writing bytes to the peer, and B is the type that is used as input for sending data.

Note that the AsyncRead may be polled for data even after it has signalled end of data. Only use AsyncReads that can correctly handle this.