Struct witx::InterfaceFunc
source · [−]pub struct InterfaceFunc {
pub abi: Abi,
pub name: Id,
pub params: Vec<InterfaceFuncParam>,
pub results: Vec<InterfaceFuncParam>,
pub noreturn: bool,
pub docs: String,
}
Fields
abi: Abi
name: Id
params: Vec<InterfaceFuncParam>
results: Vec<InterfaceFuncParam>
noreturn: bool
docs: String
Implementations
sourceimpl InterfaceFunc
impl InterfaceFunc
sourcepub fn wasm_signature(&self) -> (Vec<WasmType>, Vec<WasmType>)
pub fn wasm_signature(&self) -> (Vec<WasmType>, Vec<WasmType>)
Get the WebAssembly type signature for this interface function
The first entry returned is the list of parameters and the second entry is the list of results for the wasm function signature.
sourcepub fn call_wasm(&self, module: &Id, bindgen: &mut impl Bindgen)
pub fn call_wasm(&self, module: &Id, bindgen: &mut impl Bindgen)
Generates an abstract sequence of instructions which represents this function being adapted as an imported function.
The instructions here, when executed, will emulate a language with
interface types calling the concrete wasm implementation. The parameters
for the returned instruction sequence are the language’s own
interface-types parameters. One instruction in the instruction stream
will be a Call
which represents calling the actual raw wasm function
signature.
This function is useful, for example, if you’re building a language generator for WASI bindings. This will document how to translate language-specific values into the wasm types to call a WASI function, and it will also automatically convert the results of the WASI function back to a language-specific value.
sourcepub fn call_interface(&self, module: &Id, bindgen: &mut impl Bindgen)
pub fn call_interface(&self, module: &Id, bindgen: &mut impl Bindgen)
This is the dual of InterfaceFunc::call_wasm
, except that instead of
calling a wasm signature it generates code to come from a wasm signature
and call an interface types signature.
sourceimpl InterfaceFunc
impl InterfaceFunc
Trait Implementations
sourceimpl Clone for InterfaceFunc
impl Clone for InterfaceFunc
sourcefn clone(&self) -> InterfaceFunc
fn clone(&self) -> InterfaceFunc
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for InterfaceFunc
impl Debug for InterfaceFunc
sourceimpl Hash for InterfaceFunc
impl Hash for InterfaceFunc
sourceimpl PartialEq<InterfaceFunc> for InterfaceFunc
impl PartialEq<InterfaceFunc> for InterfaceFunc
sourcefn eq(&self, other: &InterfaceFunc) -> bool
fn eq(&self, other: &InterfaceFunc) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &InterfaceFunc) -> bool
fn ne(&self, other: &InterfaceFunc) -> bool
This method tests for !=
.
impl Eq for InterfaceFunc
impl StructuralEq for InterfaceFunc
impl StructuralPartialEq for InterfaceFunc
Auto Trait Implementations
impl RefUnwindSafe for InterfaceFunc
impl !Send for InterfaceFunc
impl !Sync for InterfaceFunc
impl Unpin for InterfaceFunc
impl UnwindSafe for InterfaceFunc
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more