pub trait AsyncReady {
type Ok;
type Err: Error + Send + Sync;
// Required method
fn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<Self::Ok, Self::Err>>;
// Provided method
fn poll_ready_unpin(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<Self::Ok, Self::Err>>
where Self: Unpin + Sized { ... }
}
Expand description
Determine if a struct is async-ready to yield futures.
This is useful when a Stream
borrows an internal struct, and the internal
struct is in charge of establishing the io channel. That way the stream and
the readiness can be decoupled.
Once the IO channel is async-ready, poll_async-ready
should always return
Poll::Ready
.