-
|
I was just reading the documentation for tokio::JoinSet for the first time.
Can someone please explain this to me here? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
The pub trait Future {
type Output;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>;
}So when you manually implement the If all you want is a way try to get the next future if one is immediately available, then you shouldn't use the poll methods. Instead, use |
Beta Was this translation helpful? Give feedback.
The
Futuretrait is defined like this:documentation
So when you manually implement the
Futuretrait, the context is available to you. It's not available when using the async/await syntax.If all you want is a way try to get the next future if one is immediately available, then you shouldn't use the poll methods. Instead, use
now_or_neveron the non-poll method. You may also want to file a feature request for atry_join_next. (Similar to howmpsc::Receiverhasrecv,try_recv, andpoll_recv.)