Our great sponsors
-
tokio
A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
Futures work very differently than threads: They enable cooperative multitasking. It's a really complex topic to explain. The result is that if you use futures, you need an async runtime such as tokio, and all the libraries you use for IO need to work with Futures. There are two ways how IO can be implemented: In a blocking way (which works well with threads managed by the operating way) or in an asynchronous way (which works well with an async runtime). Because pcap, the library you use, isn't asynchronous, using Futures doesn't make sense.