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

Function annotate_wat

crates/explorer/src/lib.rs:108–120  ·  view source on GitHub ↗
(wasm: &[u8])

Source from the content-addressed store, hash-verified

106}
107
108fn annotate_wat(wasm: &[u8]) -> Result<AnnotatedWat> {
109 let printer = wasmprinter::Config::new();
110 let mut storage = String::new();
111 let chunks = printer
112 .offsets_and_lines(wasm, &mut storage)
113 .to_wasmtime_result()?
114 .map(|(offset, wat)| AnnotatedWatChunk {
115 wasm_offset: offset.map(|o| WasmOffset(u32::try_from(o).unwrap())),
116 wat: wat.to_string(),
117 })
118 .collect();
119 Ok(AnnotatedWat { chunks })
120}
121
122#[derive(Serialize, Debug)]
123struct AnnotatedAsm {

Callers 1

generateFunction · 0.85

Calls 8

WasmOffsetClass · 0.85
OkFunction · 0.85
collectMethod · 0.80
to_wasmtime_resultMethod · 0.80
newFunction · 0.50
mapMethod · 0.45
unwrapMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected