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: StringImplementations§
Source§impl 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.
Trait Implementations§
Source§impl Clone for InterfaceFunc
impl Clone for InterfaceFunc
Source§fn clone(&self) -> InterfaceFunc
fn clone(&self) -> InterfaceFunc
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InterfaceFunc
impl Debug for InterfaceFunc
impl Eq for InterfaceFunc
Source§impl Hash for InterfaceFunc
impl Hash for InterfaceFunc
Source§impl PartialEq for InterfaceFunc
impl PartialEq for InterfaceFunc
impl StructuralPartialEq for InterfaceFunc
Auto Trait Implementations§
impl !Send for InterfaceFunc
impl !Sync for InterfaceFunc
impl Freeze for InterfaceFunc
impl RefUnwindSafe for InterfaceFunc
impl Unpin for InterfaceFunc
impl UnsafeUnpin for InterfaceFunc
impl UnwindSafe for InterfaceFunc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more