Adding tokio library as a dependency

Run this command in a terminal, in your project's directory:

cargo add tokio

To add it manually, edit your project's Cargo.toml file and add to the [dependencies] section:

tokio = "1.52.1"

The tokio library will be automatically available globally. Read the tokio library documentation.

Back to the crate overview.