run_with_request

Function run_with_request 

Source
pub fn run_with_request<F, R>(handler: F)
where F: FnOnce(&mut Request) -> R, R: IntoResponse,
Expand description

Runs a handler function with direct access to the request.

Use this when you need mutable access to the request within your handler.

§Example

use wasm_runner_sdk::prelude::*;

fn my_handler(req: &mut Request) -> impl IntoResponse {
    let method = req.method();
    let path = req.path();
    format!("{} {}", method, path)
}

#[no_mangle]
pub extern "C" fn _start() {
    run_with_request(my_handler);
}