Class: Wasmtime::Extern
- Inherits:
-
Object
- Object
- Wasmtime::Extern
- Defined in:
- ext/src/ruby_api/externals.rs
Overview
An external item to a WebAssembly module, or a list of what can possibly be exported from a Wasm module.
Instance Method Summary collapse
-
#to_func ⇒ Func
Returns the exported function or raises a ‘ConversionError` when the export is not a function.
-
#to_global ⇒ Global
Returns the exported global or raises a ‘ConversionError` when the export is not a global.
-
#to_memory ⇒ Memory
Returns the exported memory or raises a ‘ConversionError` when the export is not a memory.
-
#to_table ⇒ Table
Returns the exported table or raises a ‘ConversionError` when the export is not a table.
Instance Method Details
#to_func ⇒ Func
Returns the exported function or raises a ‘ConversionError` when the export is not a function.
55 56 57 58 59 60 |
# File 'ext/src/ruby_api/externals.rs', line 55
pub fn to_func(rb_self: Obj<Self>) -> Result<Value, Error> {
match rb_self.get() {
Extern::Func(f) => Ok(**f),
_ => conversion_err!(Self::inner_class(rb_self), Func::class()),
}
}
|
#to_global ⇒ Global
Returns the exported global or raises a ‘ConversionError` when the export is not a global.
65 66 67 68 69 70 |
# File 'ext/src/ruby_api/externals.rs', line 65
pub fn to_global(rb_self: Obj<Self>) -> Result<Value, Error> {
match rb_self.get() {
Extern::Global(g) => Ok(**g),
_ => conversion_err!(Self::inner_class(rb_self), Global::class()),
}
}
|
#to_memory ⇒ Memory
Returns the exported memory or raises a ‘ConversionError` when the export is not a memory.
76 77 78 79 80 81 |
# File 'ext/src/ruby_api/externals.rs', line 76
pub fn to_memory(rb_self: Obj<Self>) -> Result<Value, Error> {
match rb_self.get() {
Extern::Memory(m) => Ok(**m),
_ => conversion_err!(Self::inner_class(rb_self), Memory::class()),
}
}
|
#to_table ⇒ Table
Returns the exported table or raises a ‘ConversionError` when the export is not a table.
86 87 88 89 90 91 |
# File 'ext/src/ruby_api/externals.rs', line 86
pub fn to_table(rb_self: Obj<Self>) -> Result<Value, Error> {
match rb_self.get() {
Extern::Table(t) => Ok(**t),
_ => conversion_err!(Self::inner_class(rb_self), Table::class()),
}
}
|