// *** before: ***
// a chain of combinators: the order of the steps read inside out
fn load(id: u32) -> impl Future<Item = String, Error = Error> {
fetch_user(id)
.and_then(|user| fetch_profile(user.profile_id))
.map(|profile| profile.name)
}
// *** in version 1.39: ***
// the same steps, written as ordinary sequential code
async fn load(id: u32) -> Result<String, Error> {
let user = fetch_user(id).await?;
let profile = fetch_profile(user.profile_id).await?;
Ok(profile.name)
}