MCPcopy Create free account
hub / github.com/danbugs/serverside-wasm-book-code / code

Method code

chapter05/wasi_nn_example/src/bindings.rs:376–393  ·  view source on GitHub ↗

Return the error code.

(&self)

Source from the content-addressed store, hash-verified

374 #[allow(unused_unsafe, clippy::all)]
375 /// Return the error code.
376 pub fn code(&self) -> ErrorCode {
377 unsafe {
378 #[cfg(target_arch = "wasm32")]
379 #[link(
380 wasm_import_module = "wasi:nn/errors@0.2.0-rc-2024-08-19"
381 )]
382 extern "C" {
383 #[link_name = "[method]error.code"]
384 fn wit_import(_: i32) -> i32;
385 }
386 #[cfg(not(target_arch = "wasm32"))]
387 fn wit_import(_: i32) -> i32 {
388 unreachable!()
389 }
390 let ret = wit_import((self).handle() as i32);
391 ErrorCode::_lift(ret as u8)
392 }
393 }
394 }
395 impl Error {
396 #[allow(unused_unsafe, clippy::all)]

Callers

nothing calls this directly

Calls 2

wit_importFunction · 0.70
handleMethod · 0.45

Tested by

no test coverage detected