19 More crates and async Rust

This chapter covers

  • Another external crate: reqwest
  • Using feature flags to compile part of a crate
  • Using async Rust for code that doesn’t block

In this chapter, we will finally get around to using the reqwest crate. As you read through this chapter, you’ll soon see why we didn’t learn it until now: it’s because the reqwest crate is the first one we have encountered that involves async Rust! Well, sort of. Read on to find out.

While we’re at it, we’ll also learn about feature flags, which let you bring in just part of an external crate and thereby help keep compilation time down.

19.1 The reqwest crate

Back in chapter 17, we had a code sample that included a Client (http://mng.bz/mjv4) from the reqwest crate in ...

Get Learn Rust in a Month of Lunches now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.