Rust is a modern language and has many approaches and crates that we can use to implement microservices. We can split these into two categories—synchronous frameworks and asynchronous frameworks. If you want to write synchronous microservices, you can implement a handler as a sequence of expressions and methods calls. But writing asynchronous code is hard in Rust, because it doesn't use a garbage collector and you have to take into account the lifetimes of all objects, including callbacks. This is not a simple task, because you can't stop the execution at any line of the code. Instead, you have to write code that won't block the execution for a long period of time. This challenge can be elegantly solved with the futures crate.
In this chapter, you will learn about how the futures crate...