MCPcopy Create free account
hub / github.com/bytecodealliance/wstd / poll_next

Method poll_next

src/io/streams.rs:152–164  ·  view source on GitHub ↗
(self: Pin<&mut Self>, cx: &mut Context<'_>)

Source from the content-addressed store, hash-verified

150impl futures_lite::stream::Stream for AsyncInputChunkStream {
151 type Item = Result<Vec<u8>, std::io::Error>;
152 fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
153 match self.stream.poll_ready(cx) {
154 Poll::Pending => Poll::Pending,
155 Poll::Ready(()) => match self.stream.stream.read(self.chunk_size as u64) {
156 Ok(r) if r.is_empty() => Poll::Pending,
157 Ok(r) => Poll::Ready(Some(Ok(r))),
158 Err(StreamError::LastOperationFailed(err)) => {
159 Poll::Ready(Some(Err(std::io::Error::other(err.to_debug_string()))))
160 }
161 Err(StreamError::Closed) => Poll::Ready(None),
162 },
163 }
164 }
165}
166
167pin_project_lite::pin_project! {

Callers

nothing calls this directly

Calls 3

poll_readyMethod · 0.80
readMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected