Module: Wasmtime

Defined in:
ext/src/ruby_api/mod.rs,
lib/wasmtime.rb,
lib/wasmtime/error.rb,
lib/wasmtime/version.rb,
lib/wasmtime/component.rb

Defined Under Namespace

Modules: Component Classes: Caller, ConversionError, Engine, Error, Extern, Func, FuncType, Global, Instance, Linker, Memory, Module, PoolingAllocationConfig, ResultError, Store, Table, Trap, WasiCtx, WasiCtxBuilder, WasiExit

Constant Summary collapse

VERSION =
"27.0.0"

Class Method Summary collapse

Class Method Details

.wat2wasm(wat) ⇒ String

Converts a WAT String into Wasm.

Parameters:

  • wat (String)

Returns:

  • (String)

    The Wasm represented as a binary String.



65
66
67
68
69
70
# File 'ext/src/ruby_api/mod.rs', line 65

pub fn wat2wasm(wat: RString) -> Result<RString, Error> {
        wat::parse_str(unsafe { wat.as_str()? })
            .map(|bytes| RString::from_slice(bytes.as_slice()))
            .map_err(|e| crate::error!("{}", e))
    }
}