Open shaitao opened 6 years ago
Thanks for the feedback.
Do you have specific examples where you got tripped up? What were you trying to implement? What did your first attempt look like?
I completely agree that a write-up of "how you likely want to implement and think about poll
" is likely a good addition.
@jonhoo What would you say should go in that section?
Thanks for the feedback.
Do you have specific examples where you got tripped up? What were you trying to implement? What did your first attempt look like? It looks like that if the poll of a source future block and all the futures will block. if I implement
fn poll(&self)->Poll<T,E>{ let x = loading()? //this is not a future and would block Ok(Async::Ready(x)) //how to return NotReady }
@carllerche
NotReady
.poll
in a loop
to ensure the first point.try_ready!
is a great tool, but keep in mind that it will prevent you from polling a second internal future if the first you check returns NotReady
, which is not okay!UnorderedFutures
and UnorderedStream
, show what they replace (Vec<Future>
and Vec<Stream>
respectively) and why the naive implementation isn't great.
It's confusing to implement poll, when and where to use NotReady