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

Method poll_write

digest-io-async/src/writer.rs:98–111  ·  view source on GitHub ↗
(
        self: Pin<&mut Self>,
        cx: &mut Context<'_>,
        buf: &[u8],
    )

Source from the content-addressed store, hash-verified

96
97impl<D: Digest, W: AsyncWrite> AsyncWrite for HashWriter<D, W> {
98 fn poll_write(
99 self: Pin<&mut Self>,
100 cx: &mut Context<'_>,
101 buf: &[u8],
102 ) -> Poll<io::Result<usize>> {
103 let this = self.project();
104 let result = this.writer.poll_write(cx, buf);
105 if let Poll::Ready(Ok(n)) = result {
106 if n > 0 {
107 this.hasher.update(&buf[..n]);
108 }
109 }
110 result
111 }
112
113 fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
114 self.project().writer.poll_flush(cx)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected