The tokio crate
The tokio crate provides the functionality to work with the network connections of files in an asynchronous manner. It includes wrappers for the TCP and UDP sockets—TcpStream and UdpSocket. It also includes types to access a filesystem through the Future and Stream traits. There is no cross-platform approach to work with files asynchronously, because operating systems have their own implementations of non-blocking APIs. Some operating systems, however, don't have good asynchronous APIs at all. To provide cross-platform asynchronous access to filesystems, tokio uses the tokio_threadpool crate, which has a blocking method that runs a task in a separate thread. This helps to implement asynchronous interaction for types that can ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access