MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / poll_write

Method poll_write

crates/wasi/src/p2/pipe.rs:131–140  ·  view source on GitHub ↗
(
        self: Pin<&mut Self>,
        _cx: &mut Context<'_>,
        buf: &[u8],
    )

Source from the content-addressed store, hash-verified

129
130impl AsyncWrite for MemoryOutputPipe {
131 fn poll_write(
132 self: Pin<&mut Self>,
133 _cx: &mut Context<'_>,
134 buf: &[u8],
135 ) -> Poll<io::Result<usize>> {
136 let mut buffer = self.buffer.lock().unwrap();
137 let amt = buf.len().min(self.capacity - buffer.len());
138 buffer.extend_from_slice(&buf[..amt]);
139 Poll::Ready(Ok(amt))
140 }
141 fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<io::Result<()>> {
142 Poll::Ready(Ok(()))
143 }

Callers 1

poll_consumeMethod · 0.45

Calls 5

OkFunction · 0.85
unwrapMethod · 0.45
lockMethod · 0.45
minMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected