macro_rules! export { ($ty:ident) => { ... }; ($ty:ident with_types_in $($path_to_types_root:tt)*) => { ... }; }
Expand description
Generate an exported instance of the wasi:http/proxy
world.
This macro will generate #[no_mangle]
functions as necessary to
export an implementation of the
exports::http::incoming_handler::Guest
trait. This macro takes
an argument which is a type that implements this trait:
use wasi::http::types::{IncomingRequest, ResponseOutparam};
struct MyIncomingHandler;
impl wasi::exports::http::incoming_handler::Guest for MyIncomingHandler {
fn handle(request: IncomingRequest, response_out: ResponseOutparam) {
// ...
}
}
wasi::http::proxy::export!(MyIncomingHandler);