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

Function wizen

crates/wizer/tests/all/component.rs:156–180  ·  view source on GitHub ↗
(wasm: &[u8])

Source from the content-addressed store, hash-verified

154}
155
156async fn wizen(wasm: &[u8]) -> Result<Vec<u8>> {
157 let _ = env_logger::try_init();
158
159 log::debug!(
160 "=== PreWizened Wasm ==========================================================\n\
161 {}\n\
162 ===========================================================================",
163 wasmprinter::print_bytes(&wasm).unwrap()
164 );
165 let mut store = store()?;
166 let wasm = Wizer::new()
167 .run_component(&mut store, &wasm, instantiate)
168 .await?;
169 log::debug!(
170 "=== Wizened Wasm ==========================================================\n\
171 {}\n\
172 ===========================================================================",
173 wasmprinter::print_bytes(&wasm).unwrap()
174 );
175 if log::log_enabled!(log::Level::Debug) {
176 std::fs::write("test.wasm", &wasm).unwrap();
177 }
178
179 Ok(wasm)
180}
181
182async fn wizen_and_run_wat(expected: i32, wat: &str) -> Result<()> {
183 let wasm = wat::parse_str(wat)?;

Callers 2

wizen_and_run_watFunction · 0.70
export_is_removedFunction · 0.70

Calls 6

OkFunction · 0.85
run_componentMethod · 0.80
storeFunction · 0.70
newFunction · 0.50
writeFunction · 0.50
unwrapMethod · 0.45

Tested by

no test coverage detected