How to read bytes and so on from Framed (tokio)?

I've a code:

let mut inbound_bytes = BytesCodec::new().framed(inbound);
let mut outbound_bytes = BytesCodec::new().framed(outbound);
let (mut ri, mut wi) = inbound_bytes.split();
let (mut ro, mut wo) = outbound_bytes.split();

How can I read from ri and write to wi and so on? QQ

Reading is done through the Stream trait and writing is done with the Sink trait. Note that the futures crate provides a StreamExt and SinkExt with utilities for working with these types.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.