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

Method write

crates/c-api/src/wasi.rs:213–226  ·  view source on GitHub ↗
(&mut self, bytes: Bytes)

Source from the content-addressed store, hash-verified

211#[async_trait::async_trait]
212impl wasmtime_wasi::p2::OutputStream for CustomOutputStream {
213 fn write(&mut self, bytes: Bytes) -> Result<(), StreamError> {
214 let wrote = self
215 .inner
216 .raw_write(&bytes)
217 .map_err(|e| StreamError::LastOperationFailed(e.into()))?;
218
219 if wrote != bytes.len() {
220 return Err(StreamError::LastOperationFailed(wasmtime::format_err!(
221 "Partial writes in wasip2 implementation are not allowed"
222 )));
223 }
224
225 Ok(())
226 }
227 fn flush(&mut self) -> Result<(), StreamError> {
228 Ok(())
229 }

Callers 15

wasmtime_tag_newFunction · 0.45
wasmtime_val_cloneFunction · 0.45
wasmtime_exnref_newFunction · 0.45
wasmtime_eqref_typeFunction · 0.45
wasmtime_anyref_typeFunction · 0.45
wasmtime_valtype_newFunction · 0.45
wasmtime_valtype_cloneFunction · 0.45
wasmtime_heaptype_cloneFunction · 0.45
wasmtime_reftype_cloneFunction · 0.45
wasmtime_memorytype_newFunction · 0.45

Calls 3

OkFunction · 0.85
raw_writeMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected