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
trueorfalse, 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
Ruby
Array.- tuple
Ruby
Arrayof the same size of tuple. Example:tuple<T, U>would be converted to[T, U].- record
Ruby
Hashwhere field names are +String+s (for performance, see this benchmark).- 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
nilis mapped toNone, anything else is mapped toSome(T).- flags
Ruby
Arrayof +String+s.- enum
Ruby
String. Exception will be raised of theStringis 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
or borrow ) 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.
80 81 82 83 |
# File 'ext/src/ruby_api/component/func.rs', line 80
pub fn call(&self, args: &[Value]) -> Result<Value, Error> {
let ruby = Ruby::get().unwrap();
Func::invoke(&ruby, self.store, &self.inner, args)
}
|