1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
use crate::http::{Method, Request};
use crate::routing::{Filter, PathState};

pub struct MethodFilter(pub Method);

impl Filter for MethodFilter {
    #[inline]
    fn filter(&self, req: &mut Request, _path: &mut PathState) -> bool {
        req.method() == self.0
    }
}