-
-
Save xeioex/29967da0612ba57cf88c98db951518c0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/nginx-wasi/src/bindings.rs b/nginx-wasi/src/bindings.rs | |
| index c9ddfae..192d695 100644 | |
| --- a/nginx-wasi/src/bindings.rs | |
| +++ b/nginx-wasi/src/bindings.rs | |
| @@ -32,31 +32,25 @@ wasmtime::component::bindgen!({ | |
| pub fn add_to_linker_async(linker: &mut Linker<Ctx>) -> Result<()> { | |
| wasmtime_wasi_io::add_to_linker_async(linker)?; | |
| - fn type_annotate<F>(val: F) -> F | |
| - where | |
| - F: Fn(&mut Ctx) -> &mut Ctx, | |
| - { | |
| - val | |
| - } | |
| + fn host_accessor(ctx: &mut Ctx) -> &mut Ctx { ctx } | |
| - let closure = type_annotate(|t| t); | |
| - wasi::clocks::monotonic_clock::add_to_linker_get_host(linker, closure)?; | |
| - wasi::clocks::wall_clock::add_to_linker_get_host(linker, closure)?; | |
| - wasi::cli::environment::add_to_linker_get_host(linker, closure)?; | |
| - wasi::cli::exit::add_to_linker_get_host(linker, closure)?; | |
| - wasi::cli::stdin::add_to_linker_get_host(linker, closure)?; | |
| - wasi::cli::stdout::add_to_linker_get_host(linker, closure)?; | |
| - wasi::cli::stderr::add_to_linker_get_host(linker, closure)?; | |
| - wasi::cli::terminal_input::add_to_linker_get_host(linker, closure)?; | |
| - wasi::cli::terminal_output::add_to_linker_get_host(linker, closure)?; | |
| - wasi::cli::terminal_stdin::add_to_linker_get_host(linker, closure)?; | |
| - wasi::cli::terminal_stdout::add_to_linker_get_host(linker, closure)?; | |
| - wasi::cli::terminal_stderr::add_to_linker_get_host(linker, closure)?; | |
| - wasi::filesystem::preopens::add_to_linker_get_host(linker, closure)?; | |
| - wasi::filesystem::types::add_to_linker_get_host(linker, closure)?; | |
| - wasi::random::random::add_to_linker_get_host(linker, closure)?; | |
| - wasi::http::types::add_to_linker_get_host(linker, closure)?; | |
| - wasi::http::outgoing_handler::add_to_linker_get_host(linker, closure)?; | |
| + wasi::clocks::monotonic_clock::add_to_linker(linker, host_accessor)?; | |
| + wasi::clocks::wall_clock::add_to_linker(linker, host_accessor)?; | |
| + wasi::cli::environment::add_to_linker(linker, host_accessor)?; | |
| + wasi::cli::exit::add_to_linker(linker, host_accessor)?; | |
| + wasi::cli::stdin::add_to_linker(linker, host_accessor)?; | |
| + wasi::cli::stdout::add_to_linker(linker, host_accessor)?; | |
| + wasi::cli::stderr::add_to_linker(linker, host_accessor)?; | |
| + wasi::cli::terminal_input::add_to_linker(linker, host_accessor)?; | |
| + wasi::cli::terminal_output::add_to_linker(linker, host_accessor)?; | |
| + wasi::cli::terminal_stdin::add_to_linker(linker, host_accessor)?; | |
| + wasi::cli::terminal_stdout::add_to_linker(linker, host_accessor)?; | |
| + wasi::cli::terminal_stderr::add_to_linker(linker, host_accessor)?; | |
| + wasi::filesystem::preopens::add_to_linker(linker, host_accessor)?; | |
| + wasi::filesystem::types::add_to_linker(linker, host_accessor)?; | |
| + wasi::random::random::add_to_linker(linker, host_accessor)?; | |
| + wasi::http::types::add_to_linker(linker, host_accessor)?; | |
| + wasi::http::outgoing_handler::add_to_linker(linker, host_accessor)?; | |
| Ok(()) | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment