MCPcopy Create free account
hub / github.com/HFQR/xitca-web / poll_frame

Method poll_frame

http-encoding/src/coder.rs:57–78  ·  view source on GitHub ↗
(self: Pin<&mut Self>, cx: &mut Context<'_>)

Source from the content-addressed store, hash-verified

55 type Error = CoderError;
56
57 fn poll_frame(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Result<Frame<Self::Data>, Self::Error>>> {
58 let mut this = self.project();
59
60 while let Some(res) = ready!(this.body.as_mut().poll_frame(cx)) {
61 match res? {
62 Frame::Data(item) => {
63 if let Some(item) = this.coder.code(item)? {
64 return Poll::Ready(Some(Ok(Frame::Data(item))));
65 }
66 }
67 Frame::Trailers(trailers) => {
68 this.trailers.replace(trailers);
69 break;
70 }
71 }
72 }
73
74 match this.coder.code_eof()? {
75 Some(res) => Poll::Ready(Some(Ok(Frame::Data(res)))),
76 None => Poll::Ready(this.trailers.take().map(|trailsers| Ok(Frame::Trailers(trailsers)))),
77 }
78 }
79
80 fn is_end_stream(&self) -> bool {
81 // forward is_end_stream to coder as it determines the data length after (de)compress.

Callers

nothing calls this directly

Calls 7

ReadyInterface · 0.85
DataClass · 0.85
TrailersClass · 0.50
codeMethod · 0.45
code_eofMethod · 0.45
mapMethod · 0.45
takeMethod · 0.45

Tested by

no test coverage detected