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.
132 133 134 135 136 137 |
# File 'ext/src/ruby_api/externals.rs', line 132
pub fn to_func(ruby: &Ruby, rb_self: Obj<Self>) -> Result<Value, Error> {
match *rb_self {
Extern::Func(f) => Ok(f.as_value()),
_ => conversion_err!(Self::inner_class(rb_self), Func::class(ruby)),
}
}
|
#to_global ⇒ Global
Returns the exported global or raises a ‘ConversionError` when the export is not a global.
142 143 144 145 146 147 |
# File 'ext/src/ruby_api/externals.rs', line 142
pub fn to_global(ruby: &Ruby, rb_self: Obj<Self>) -> Result<Value, Error> {
match *rb_self {
Extern::Global(g) => Ok(g.as_value()),
_ => conversion_err!(Self::inner_class(rb_self), Global::class(ruby)),
}
}
|
#to_memory ⇒ Memory
Returns the exported memory or raises a ‘ConversionError` when the export is not a memory.
153 154 155 156 157 158 |
# File 'ext/src/ruby_api/externals.rs', line 153
pub fn to_memory(ruby: &Ruby, rb_self: Obj<Self>) -> Result<Value, Error> {
match *rb_self {
Extern::Memory(m) => Ok(m.as_value()),
_ => conversion_err!(Self::inner_class(rb_self), Memory::class(ruby)),
}
}
|
#to_table ⇒ Table
Returns the exported table or raises a ‘ConversionError` when the export is not a table.
163 164 165 166 167 168 |
# File 'ext/src/ruby_api/externals.rs', line 163
pub fn to_table(ruby: &Ruby, rb_self: Obj<Self>) -> Result<Value, Error> {
match *rb_self {
Extern::Table(t) => Ok(t.as_value()),
_ => conversion_err!(Self::inner_class(rb_self), Table::class(ruby)),
}
}
|