Function tsukuyomi::handler::wrap_ready[][src]

pub fn wrap_ready<R>(
    f: impl Fn(&mut Input) -> R
) -> impl Handler where
    R: Responder

Create an instance of Handler from the provided function.

The provided handler is synchronous, which means that the provided handler will return a result and immediately converted into an HTTP response without polling the asynchronous status.

Examples

fn index(input: &mut Input) -> &'static str {
    "Hello, Tsukuyomi.\n"
}

let app = App::builder()
    .route(("/index.html", wrap_ready(index)))
    .finish()?;