pub fn fn_guard<F>(f: F) -> impl Guard
Expand description
Creates a guard using the given function.
§Examples
use actix_web::{guard, web, HttpResponse};
web::route()
.guard(guard::fn_guard(|ctx| {
ctx.head().headers().contains_key("content-type")
}))
.to(|| HttpResponse::Ok());