Skip to main content

run_handler

Function run_handler 

Source
pub fn run_handler<Req, Resp>(
    handler: &mut dyn Handler<Req, Resp>,
    request: Req,
    world: &mut World,
) -> Result<Resp, String>
Expand description

Execute a handler against the world with the given request.

This is the transport-neutral invocation entrypoint. Transport adapters (axum routes, WASM bridge, etc.) call this to run a handler function with ECS parameter injection.

§Example

ⓘ
let mut handler = (|req: MyRequest| Ok(MyResponse { ok: true }))
    .into_handler("my_handler");
let result = run_handler(&mut *handler, MyRequest { id: 1 }, &mut world);