How to use rustls crate in Rust TLS

Enable rustls in Rust by adding the rustls-tls feature to your reqwest dependency in Cargo.toml.

Enable rustls by adding the rustls-tls feature to your reqwest dependency in Cargo.toml.

[dependencies]
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls"] }

This configuration switches the TLS backend from the default OpenSSL to rustls, a pure Rust implementation, as demonstrated in the trpl crate.