MCPcopy Create free account
hub / github.com/RustCrypto/utils / poll_read

Method poll_read

digest-io-async/src/reader.rs:97–113  ·  view source on GitHub ↗
(
        self: Pin<&mut Self>,
        cx: &mut Context<'_>,
        buf: &mut ReadBuf<'_>,
    )

Source from the content-addressed store, hash-verified

95
96impl<D: Digest, R: AsyncRead> AsyncRead for HashReader<D, R> {
97 fn poll_read(
98 self: Pin<&mut Self>,
99 cx: &mut Context<'_>,
100 buf: &mut ReadBuf<'_>,
101 ) -> Poll<io::Result<()>> {
102 let this = self.project();
103 let filled_before = buf.filled().len();
104 let result = this.reader.poll_read(cx, buf);
105 if let Poll::Ready(Ok(())) = result {
106 let filled_after = buf.filled().len();
107 if filled_after > filled_before {
108 this.hasher
109 .update(&buf.filled()[filled_before..filled_after]);
110 }
111 }
112 result
113 }
114}
115
116impl<D: Digest + FixedOutputReset, R> HashReader<D, R> {

Callers

nothing calls this directly

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected