It will yield to the runtime. It is resumed when the runtime decides that it wants to resume the future. Generally, you tell the runtime that you want to be resumed using the Waker in the task context. That is, the runtime creates a waker and gives it to the future in the context. When the future is ready to execute again, something calls wake on the waker, which lets the runtime know that it should resume the future soon.
So the runtime will finally call std::ops::Generator::resume? Or it will call std::future::Future::poll again? I prefer std::ops::Generator::resume, because this behave the same way as a generator.
Generators are unstable, so the runtime cannot call any generator-specific methods. Therefore, the runtime calls Future::poll again. However, when the future comes from async/await syntax, the poll method just calls Generator::resume internally.
No, it will not implement the generator trait. That's an internal implementation detail of the future. Instead, it will be a private internal type that you can't see that implements generator.
If this is true. How async runtime resume it? (You have said runtime choose not to call resume is just because generators is unstable, in my understanding, this implied that runtime can choose to use the resume approach)
This used to work by converting the Generator produced by async to a Future with this method. This has recently changed in rust-lang/rust#104321 to be done internally in the compiler. I'm not sure how it works now, but it looks like it changes how yield are transformed into code at the MIR level by special casing the ones that come from async.