await would be pretty much equivalent to Python’s yield from, if Rust’s generators accepted arguments (and ignoring pinning and the fact that GeneratorState and Poll are different enums). Without that capability it’s closest to a manual loop:
await foo
expands to something like (again, ignoring pinning because it’s not important to understand the expansion)
{
let mut future = foo;
loop {
match future.poll(magical_local_waker_variable) {
Poll::Pending => yield Poll::Pending,
Poll::Ready(value) => break value,
}
}
}
note that it is not the future that is being yielded, the current generator is polling it and then yielding Pending if the future returned it. Also see the magical_local_waker_variable, this is part of what blocks being able to nicely implement async/await as macros in a user library, somehow the two macros must communicate this variable.