[][src]Trait wasmtime_async::FuncExt

pub trait FuncExt {
    fn new_async<F>(store: &Store, ty: FuncType, func: F) -> Func
    where
        F: 'static + for<'a> Fn(Caller<'a>, &'a [Val], &'a mut [Val]) -> Box<dyn Future<Output = Result<(), Trap>> + 'a>
;
fn wrap_async<Params, Results, F>(store: &Store, func: F) -> Func
    where
        F: IntoFuncAsync<Params, Results>
;
fn wrap_async0<F, R>(store: &Store, func: F) -> Func
    where
        F: 'static + for<'a> Fn(Caller<'a>) -> Box<dyn Future<Output = R> + 'a>,
        R: WasmRet
;
fn wrap_async1<F, A1, R>(store: &Store, func: F) -> Func
    where
        F: 'static + for<'a> Fn(Caller<'a>, A1) -> Box<dyn Future<Output = R> + 'a>,
        A1: WasmTy,
        R: WasmRet
;
fn wrap_async2<F, A1, A2, R>(store: &Store, func: F) -> Func
    where
        F: 'static + for<'a> Fn(Caller<'a>, A1, A2) -> Box<dyn Future<Output = R> + 'a>,
        A1: WasmTy,
        A2: WasmTy,
        R: WasmRet
;
fn wrap_async3<F, A1, A2, A3, R>(store: &Store, func: F) -> Func
    where
        F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3) -> Box<dyn Future<Output = R> + 'a>,
        A1: WasmTy,
        A2: WasmTy,
        A3: WasmTy,
        R: WasmRet
;
fn wrap_async4<F, A1, A2, A3, A4, R>(store: &Store, func: F) -> Func
    where
        F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4) -> Box<dyn Future<Output = R> + 'a>,
        A1: WasmTy,
        A2: WasmTy,
        A3: WasmTy,
        A4: WasmTy,
        R: WasmRet
;
fn wrap_async5<F, A1, A2, A3, A4, A5, R>(store: &Store, func: F) -> Func
    where
        F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5) -> Box<dyn Future<Output = R> + 'a>,
        A1: WasmTy,
        A2: WasmTy,
        A3: WasmTy,
        A4: WasmTy,
        A5: WasmTy,
        R: WasmRet
;
fn wrap_async6<F, A1, A2, A3, A4, A5, A6, R>(store: &Store, func: F) -> Func
    where
        F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5, A6) -> Box<dyn Future<Output = R> + 'a>,
        A1: WasmTy,
        A2: WasmTy,
        A3: WasmTy,
        A4: WasmTy,
        A5: WasmTy,
        A6: WasmTy,
        R: WasmRet
;
fn wrap_async7<F, A1, A2, A3, A4, A5, A6, A7, R>(
        store: &Store,
        func: F
    ) -> Func
    where
        F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5, A6, A7) -> Box<dyn Future<Output = R> + 'a>,
        A1: WasmTy,
        A2: WasmTy,
        A3: WasmTy,
        A4: WasmTy,
        A5: WasmTy,
        A6: WasmTy,
        A7: WasmTy,
        R: WasmRet
;
fn wrap_async8<F, A1, A2, A3, A4, A5, A6, A7, A8, R>(
        store: &Store,
        func: F
    ) -> Func
    where
        F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5, A6, A7, A8) -> Box<dyn Future<Output = R> + 'a>,
        A1: WasmTy,
        A2: WasmTy,
        A3: WasmTy,
        A4: WasmTy,
        A5: WasmTy,
        A6: WasmTy,
        A7: WasmTy,
        A8: WasmTy,
        R: WasmRet
;
fn wrap_async9<F, A1, A2, A3, A4, A5, A6, A7, A8, A9, R>(
        store: &Store,
        func: F
    ) -> Func
    where
        F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5, A6, A7, A8, A9) -> Box<dyn Future<Output = R> + 'a>,
        A1: WasmTy,
        A2: WasmTy,
        A3: WasmTy,
        A4: WasmTy,
        A5: WasmTy,
        A6: WasmTy,
        A7: WasmTy,
        A8: WasmTy,
        A9: WasmTy,
        R: WasmRet
;
fn wrap_async10<F, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>(
        store: &Store,
        func: F
    ) -> Func
    where
        F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) -> Box<dyn Future<Output = R> + 'a>,
        A1: WasmTy,
        A2: WasmTy,
        A3: WasmTy,
        A4: WasmTy,
        A5: WasmTy,
        A6: WasmTy,
        A7: WasmTy,
        A8: WasmTy,
        A9: WasmTy,
        A10: WasmTy,
        R: WasmRet
;
fn wrap_async11<F, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, R>(
        store: &Store,
        func: F
    ) -> Func
    where
        F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) -> Box<dyn Future<Output = R> + 'a>,
        A1: WasmTy,
        A2: WasmTy,
        A3: WasmTy,
        A4: WasmTy,
        A5: WasmTy,
        A6: WasmTy,
        A7: WasmTy,
        A8: WasmTy,
        A9: WasmTy,
        A10: WasmTy,
        A11: WasmTy,
        R: WasmRet
;
fn wrap_async12<F, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, R>(
        store: &Store,
        func: F
    ) -> Func
    where
        F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12) -> Box<dyn Future<Output = R> + 'a>,
        A1: WasmTy,
        A2: WasmTy,
        A3: WasmTy,
        A4: WasmTy,
        A5: WasmTy,
        A6: WasmTy,
        A7: WasmTy,
        A8: WasmTy,
        A9: WasmTy,
        A10: WasmTy,
        A11: WasmTy,
        A12: WasmTy,
        R: WasmRet
;
fn wrap_async13<F, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, R>(
        store: &Store,
        func: F
    ) -> Func
    where
        F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13) -> Box<dyn Future<Output = R> + 'a>,
        A1: WasmTy,
        A2: WasmTy,
        A3: WasmTy,
        A4: WasmTy,
        A5: WasmTy,
        A6: WasmTy,
        A7: WasmTy,
        A8: WasmTy,
        A9: WasmTy,
        A10: WasmTy,
        A11: WasmTy,
        A12: WasmTy,
        A13: WasmTy,
        R: WasmRet
;
fn wrap_async14<F, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, R>(
        store: &Store,
        func: F
    ) -> Func
    where
        F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14) -> Box<dyn Future<Output = R> + 'a>,
        A1: WasmTy,
        A2: WasmTy,
        A3: WasmTy,
        A4: WasmTy,
        A5: WasmTy,
        A6: WasmTy,
        A7: WasmTy,
        A8: WasmTy,
        A9: WasmTy,
        A10: WasmTy,
        A11: WasmTy,
        A12: WasmTy,
        A13: WasmTy,
        A14: WasmTy,
        R: WasmRet
;
fn wrap_async15<F, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, R>(
        store: &Store,
        func: F
    ) -> Func
    where
        F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15) -> Box<dyn Future<Output = R> + 'a>,
        A1: WasmTy,
        A2: WasmTy,
        A3: WasmTy,
        A4: WasmTy,
        A5: WasmTy,
        A6: WasmTy,
        A7: WasmTy,
        A8: WasmTy,
        A9: WasmTy,
        A10: WasmTy,
        A11: WasmTy,
        A12: WasmTy,
        A13: WasmTy,
        A14: WasmTy,
        A15: WasmTy,
        R: WasmRet
;
fn call_async<'a>(
        &self,
        stack: &'a mut Stack,
        params: &'a [Val]
    ) -> WasmFuture<'a, Result<Box<[Val]>>>;
fn get_async<'a>(&'a self) -> AsyncGetter<'a>; }

The extension trait to wasmtime::Func, that holds most of the interest of this crate.

Required methods

fn new_async<F>(store: &Store, ty: FuncType, func: F) -> Func where
    F: 'static + for<'a> Fn(Caller<'a>, &'a [Val], &'a mut [Val]) -> Box<dyn Future<Output = Result<(), Trap>> + 'a>, 

Wrap an asynchronous function like wasmtime::Func::new would have done.

See also wasmtime::Func::new for more details.

Running WebAssembly code that could call into a function defined like this must be done with one of the async-ready ways of calling it, or it will panic.

fn wrap_async<Params, Results, F>(store: &Store, func: F) -> Func where
    F: IntoFuncAsync<Params, Results>, 

Wrap an asynchronous function that does not take a Caller as its first argument.

See also wasmtime::Func::wrap for more details.

Running WebAssembly code that could call into a function defined like this must be done with one of the async-ready ways of calling it, or it will panic.

fn wrap_async0<F, R>(store: &Store, func: F) -> Func where
    F: 'static + for<'a> Fn(Caller<'a>) -> Box<dyn Future<Output = R> + 'a>,
    R: WasmRet

Wrap asynchronous functions that take a Caller as their first argument.

See also wasmtime::Func::wrap for more details.

Running WebAssembly code that could call into a function defined like this must be done with one of the async-ready ways of calling it, or it will panic.

fn wrap_async1<F, A1, R>(store: &Store, func: F) -> Func where
    F: 'static + for<'a> Fn(Caller<'a>, A1) -> Box<dyn Future<Output = R> + 'a>,
    A1: WasmTy,
    R: WasmRet

Wrap asynchronous functions that take a Caller as their first argument.

See also wasmtime::Func::wrap for more details.

Running WebAssembly code that could call into a function defined like this must be done with one of the async-ready ways of calling it, or it will panic.

fn wrap_async2<F, A1, A2, R>(store: &Store, func: F) -> Func where
    F: 'static + for<'a> Fn(Caller<'a>, A1, A2) -> Box<dyn Future<Output = R> + 'a>,
    A1: WasmTy,
    A2: WasmTy,
    R: WasmRet

Wrap asynchronous functions that take a Caller as their first argument.

See also wasmtime::Func::wrap for more details.

Running WebAssembly code that could call into a function defined like this must be done with one of the async-ready ways of calling it, or it will panic.

fn wrap_async3<F, A1, A2, A3, R>(store: &Store, func: F) -> Func where
    F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3) -> Box<dyn Future<Output = R> + 'a>,
    A1: WasmTy,
    A2: WasmTy,
    A3: WasmTy,
    R: WasmRet

Wrap asynchronous functions that take a Caller as their first argument.

See also wasmtime::Func::wrap for more details.

Running WebAssembly code that could call into a function defined like this must be done with one of the async-ready ways of calling it, or it will panic.

fn wrap_async4<F, A1, A2, A3, A4, R>(store: &Store, func: F) -> Func where
    F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4) -> Box<dyn Future<Output = R> + 'a>,
    A1: WasmTy,
    A2: WasmTy,
    A3: WasmTy,
    A4: WasmTy,
    R: WasmRet

Wrap asynchronous functions that take a Caller as their first argument.

See also wasmtime::Func::wrap for more details.

Running WebAssembly code that could call into a function defined like this must be done with one of the async-ready ways of calling it, or it will panic.

fn wrap_async5<F, A1, A2, A3, A4, A5, R>(store: &Store, func: F) -> Func where
    F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5) -> Box<dyn Future<Output = R> + 'a>,
    A1: WasmTy,
    A2: WasmTy,
    A3: WasmTy,
    A4: WasmTy,
    A5: WasmTy,
    R: WasmRet

Wrap asynchronous functions that take a Caller as their first argument.

See also wasmtime::Func::wrap for more details.

Running WebAssembly code that could call into a function defined like this must be done with one of the async-ready ways of calling it, or it will panic.

fn wrap_async6<F, A1, A2, A3, A4, A5, A6, R>(store: &Store, func: F) -> Func where
    F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5, A6) -> Box<dyn Future<Output = R> + 'a>,
    A1: WasmTy,
    A2: WasmTy,
    A3: WasmTy,
    A4: WasmTy,
    A5: WasmTy,
    A6: WasmTy,
    R: WasmRet

Wrap asynchronous functions that take a Caller as their first argument.

See also wasmtime::Func::wrap for more details.

Running WebAssembly code that could call into a function defined like this must be done with one of the async-ready ways of calling it, or it will panic.

fn wrap_async7<F, A1, A2, A3, A4, A5, A6, A7, R>(store: &Store, func: F) -> Func where
    F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5, A6, A7) -> Box<dyn Future<Output = R> + 'a>,
    A1: WasmTy,
    A2: WasmTy,
    A3: WasmTy,
    A4: WasmTy,
    A5: WasmTy,
    A6: WasmTy,
    A7: WasmTy,
    R: WasmRet

Wrap asynchronous functions that take a Caller as their first argument.

See also wasmtime::Func::wrap for more details.

Running WebAssembly code that could call into a function defined like this must be done with one of the async-ready ways of calling it, or it will panic.

fn wrap_async8<F, A1, A2, A3, A4, A5, A6, A7, A8, R>(
    store: &Store,
    func: F
) -> Func where
    F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5, A6, A7, A8) -> Box<dyn Future<Output = R> + 'a>,
    A1: WasmTy,
    A2: WasmTy,
    A3: WasmTy,
    A4: WasmTy,
    A5: WasmTy,
    A6: WasmTy,
    A7: WasmTy,
    A8: WasmTy,
    R: WasmRet

Wrap asynchronous functions that take a Caller as their first argument.

See also wasmtime::Func::wrap for more details.

Running WebAssembly code that could call into a function defined like this must be done with one of the async-ready ways of calling it, or it will panic.

fn wrap_async9<F, A1, A2, A3, A4, A5, A6, A7, A8, A9, R>(
    store: &Store,
    func: F
) -> Func where
    F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5, A6, A7, A8, A9) -> Box<dyn Future<Output = R> + 'a>,
    A1: WasmTy,
    A2: WasmTy,
    A3: WasmTy,
    A4: WasmTy,
    A5: WasmTy,
    A6: WasmTy,
    A7: WasmTy,
    A8: WasmTy,
    A9: WasmTy,
    R: WasmRet

Wrap asynchronous functions that take a Caller as their first argument.

See also wasmtime::Func::wrap for more details.

Running WebAssembly code that could call into a function defined like this must be done with one of the async-ready ways of calling it, or it will panic.

fn wrap_async10<F, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>(
    store: &Store,
    func: F
) -> Func where
    F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) -> Box<dyn Future<Output = R> + 'a>,
    A1: WasmTy,
    A2: WasmTy,
    A3: WasmTy,
    A4: WasmTy,
    A5: WasmTy,
    A6: WasmTy,
    A7: WasmTy,
    A8: WasmTy,
    A9: WasmTy,
    A10: WasmTy,
    R: WasmRet

Wrap asynchronous functions that take a Caller as their first argument.

See also wasmtime::Func::wrap for more details.

Running WebAssembly code that could call into a function defined like this must be done with one of the async-ready ways of calling it, or it will panic.

fn wrap_async11<F, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, R>(
    store: &Store,
    func: F
) -> Func where
    F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) -> Box<dyn Future<Output = R> + 'a>,
    A1: WasmTy,
    A2: WasmTy,
    A3: WasmTy,
    A4: WasmTy,
    A5: WasmTy,
    A6: WasmTy,
    A7: WasmTy,
    A8: WasmTy,
    A9: WasmTy,
    A10: WasmTy,
    A11: WasmTy,
    R: WasmRet

Wrap asynchronous functions that take a Caller as their first argument.

See also wasmtime::Func::wrap for more details.

Running WebAssembly code that could call into a function defined like this must be done with one of the async-ready ways of calling it, or it will panic.

fn wrap_async12<F, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, R>(
    store: &Store,
    func: F
) -> Func where
    F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12) -> Box<dyn Future<Output = R> + 'a>,
    A1: WasmTy,
    A2: WasmTy,
    A3: WasmTy,
    A4: WasmTy,
    A5: WasmTy,
    A6: WasmTy,
    A7: WasmTy,
    A8: WasmTy,
    A9: WasmTy,
    A10: WasmTy,
    A11: WasmTy,
    A12: WasmTy,
    R: WasmRet

Wrap asynchronous functions that take a Caller as their first argument.

See also wasmtime::Func::wrap for more details.

Running WebAssembly code that could call into a function defined like this must be done with one of the async-ready ways of calling it, or it will panic.

fn wrap_async13<F, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, R>(
    store: &Store,
    func: F
) -> Func where
    F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13) -> Box<dyn Future<Output = R> + 'a>,
    A1: WasmTy,
    A2: WasmTy,
    A3: WasmTy,
    A4: WasmTy,
    A5: WasmTy,
    A6: WasmTy,
    A7: WasmTy,
    A8: WasmTy,
    A9: WasmTy,
    A10: WasmTy,
    A11: WasmTy,
    A12: WasmTy,
    A13: WasmTy,
    R: WasmRet

Wrap asynchronous functions that take a Caller as their first argument.

See also wasmtime::Func::wrap for more details.

Running WebAssembly code that could call into a function defined like this must be done with one of the async-ready ways of calling it, or it will panic.

fn wrap_async14<F, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, R>(
    store: &Store,
    func: F
) -> Func where
    F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14) -> Box<dyn Future<Output = R> + 'a>,
    A1: WasmTy,
    A2: WasmTy,
    A3: WasmTy,
    A4: WasmTy,
    A5: WasmTy,
    A6: WasmTy,
    A7: WasmTy,
    A8: WasmTy,
    A9: WasmTy,
    A10: WasmTy,
    A11: WasmTy,
    A12: WasmTy,
    A13: WasmTy,
    A14: WasmTy,
    R: WasmRet

Wrap asynchronous functions that take a Caller as their first argument.

See also wasmtime::Func::wrap for more details.

Running WebAssembly code that could call into a function defined like this must be done with one of the async-ready ways of calling it, or it will panic.

fn wrap_async15<F, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, R>(
    store: &Store,
    func: F
) -> Func where
    F: 'static + for<'a> Fn(Caller<'a>, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15) -> Box<dyn Future<Output = R> + 'a>,
    A1: WasmTy,
    A2: WasmTy,
    A3: WasmTy,
    A4: WasmTy,
    A5: WasmTy,
    A6: WasmTy,
    A7: WasmTy,
    A8: WasmTy,
    A9: WasmTy,
    A10: WasmTy,
    A11: WasmTy,
    A12: WasmTy,
    A13: WasmTy,
    A14: WasmTy,
    A15: WasmTy,
    R: WasmRet

Wrap asynchronous functions that take a Caller as their first argument.

See also wasmtime::Func::wrap for more details.

Running WebAssembly code that could call into a function defined like this must be done with one of the async-ready ways of calling it, or it will panic.

fn call_async<'a>(
    &self,
    stack: &'a mut Stack,
    params: &'a [Val]
) -> WasmFuture<'a, Result<Box<[Val]>>>

Call this function in an async-ready way. This makes it possible to run functions that have been built by the helper methods provided by this crate.

See also wasmtime::Func::call for more details.

fn get_async<'a>(&'a self) -> AsyncGetter<'a>

Helper to retrieve WebAssembly functions in a way that could be called directly from Rust, without having to marshal arguments and return values.

This will usually be immediately followed by one of the methods on AsyncGetter.

This is a helper method designed to work around current Rust typesystem limitations, ie. lack of associated existential types.

Loading content...

Implementations on Foreign Types

impl FuncExt for Func[src]

Loading content...

Implementors

Loading content...