kvarn::prelude::networking

Function read_to_async

source
pub fn read_to_async<R>(reader: R) -> ReadToAsync<R>
where R: Read + Unpin,
Expand description

An adaptor between std’s Read and tokio’s AsyncRead traits. This should be used when you have a foreign type which implements read (on a Vec, for example) that returns immediately, because you buffered the actual read with tokio.

The reader should return immediately, else it’ll block.