Class: Wasmtime::Component::Func
- Inherits:
-
Object
- Object
- Wasmtime::Component::Func
- Defined in:
- ext/src/ruby_api/component/func.rs
Overview
Represents a WebAssembly component Function
Component model types conversion
Here’s how component model types map to Ruby objects:
- bool
-
Ruby
true
orfalse
, no automatic conversion happens. - s8, u8, s16, u16, etc.
-
Ruby
Integer
. Overflows raise. - f32, f64
-
Ruby
Float
. - string
-
Ruby
String
. Exception will be raised if the string is not valid UTF-8. - list<T>
-
Ruby
Array
. - tuple
-
Ruby
Array
of the same size of tuple. Example: tuple<T, U> would be converted to [T, U]. - record
-
Ruby
Hash
where field names are Strings. - result<O, E>
-
Result instance. When converting a result branch of the none type, the Result’s value MUST be
nil
.Examples of none type in a result: unparametrized
result
, result<O>, result<_, E>. - option<T>
-
nil
is mapped toNone
, anything else is mapped to Some(T). - flags
-
Ruby
Array
of Strings. - enum
-
Ruby
String
. Exception will be raised of theString
is not a valid enum value. - variant
-
Variant instance wrapping the variant’s name and optionally its value. Exception will be raised for:
-
invalid Variant#name,
-
unparametrized variant and not nil Variant#value.
-
- resource (own<T> or borrow<T>)
-
Not yet supported.
Instance Method Summary collapse
-
#call(*args) ⇒ Object
Calls a Wasm component model function.
Instance Method Details
#call(*args) ⇒ Object
Calls a Wasm component model function.
79 80 81 |
# File 'ext/src/ruby_api/component/func.rs', line 79
pub fn call(&self, args: &[Value]) -> Result<Value, Error> {
Func::invoke(self.store, &self.inner, args)
}
|