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

Function read

crates/test-programs/src/bin/p2_cli_hostcall_fuel.rs:41–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39}
40
41fn read() {
42 let f = preopen()
43 .open_at(
44 PathFlags::empty(),
45 "1mb",
46 OpenFlags::empty(),
47 DescriptorFlags::empty(),
48 )
49 .unwrap();
50
51 // 0-length is ok
52 f.read(0, 0).unwrap();
53
54 // This isn't transferring data from the guest to the host, so this is ok.
55 f.read(1 << 20, 0).unwrap();
56
57 // Host shouldn't allocate based on what the guest asks for...
58 f.read(u64::MAX, 0).unwrap();
59
60 f.read_via_stream(0)
61 .unwrap()
62 .blocking_read(1 << 20)
63 .unwrap();
64}
65
66fn write() {
67 let f = preopen()

Callers 13

mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
build_adapterMethod · 0.50

Calls 7

preopenFunction · 0.85
emptyFunction · 0.50
unwrapMethod · 0.45
open_atMethod · 0.45
readMethod · 0.45
blocking_readMethod · 0.45
read_via_streamMethod · 0.45

Tested by

no test coverage detected