pub fn method(mut self, method: Method) -> Self {
        Rc::get_mut(&mut self.guards)
            .unwrap()
            .push(Box::new(guard::Method(method)));
        self
    }
/// Add method guard to the route.
///
/// ```
/// # use actix_web::*;
/// # fn main() {
/// App::new().service(web::resource("/path").route(
///     web::get()
///         .method(http::Method::CONNECT)
///         .guard(guard::Header("content-type", "text/plain"))
///         .to(|req: HttpRequest| HttpResponse::Ok()))
/// );
/// # }
/// ```
Add method guard to the route.
Add method guard to the route .
pub fn method(mut self, method: Method) -> Self {
        Rc::get_mut(&mut self.guards)
            .unwrap()
            .push(Box::new(guard::Method(method)));
        self
    }
pub fn method ( mut self , method : Method ) -> Self { Rc :: get_mut ( & mut self . guards ) . unwrap ( ) . push ( Box :: new ( guard :: Method ( method ) ) ) ; self }
Add method guard to the route.
Add method guard to the route .
mut self
method
Method
mut self
method
Method
use actix_web::*;
None
fn main() {
:new().service(web::resource("/path").route(
web::get()
.method
.guard(guard::Header("content-type", "text/plain"))
.to(|req: HttpRequest| HttpResponse::Ok()))
).
: new () . service ( web :: resource ( " / path " ) . route ( web :: get () . method . guard ( guard :: Header ( " content - type " " text / plain " )) . to ( |req : HttpRequest| HttpResponse :: Ok () )) ) .
}
None