Trait rama::matcher::MatchFn

pub trait MatchFn<S, Request, A>: Sealed<S, Request, A> + Send + Sync + 'static {
    // Required method
    fn call(
        &self,
        ext: Option<&mut Extensions>,
        ctx: &Context<S>,
        req: &Request,
    ) -> bool;
}
Expand description

A MatchFn is a Matcher implemented using a function.

You do not need to implement this trait yourself. Instead, you need to use the match_fn function to create a MatchFn.

Required Methods§

fn call( &self, ext: Option<&mut Extensions>, ctx: &Context<S>, req: &Request, ) -> bool

returns true on a match, false otherwise

ext is None in case the callee is not interested in collecting potential match metadata gathered during the matching process. An example of this path parameters for an http Uri matcher.

Implementors§

§

impl<F, S, Request> MatchFn<S, Request, (Option<&mut Extensions>, Context<S>, Request)> for F
where F: Fn(Option<&mut Extensions>, &Context<S>, &Request) -> bool + Send + Sync + 'static,

§

impl<F, S, Request> MatchFn<S, Request, ((), (), Option<&mut Extensions>, Request)> for F
where F: Fn(Option<&mut Extensions>, &Request) -> bool + Send + Sync + 'static,

§

impl<F, S, Request> MatchFn<S, Request, ((), (), (), (), Option<&mut Extensions>)> for F
where F: Fn(Option<&mut Extensions>) -> bool + Send + Sync + 'static,

§

impl<F, S, Request> MatchFn<S, Request, ((), (), (), (), (), (), Option<&mut Extensions>, Context<S>)> for F
where F: Fn(Option<&mut Extensions>, &Context<S>) -> bool + Send + Sync + 'static,

§

impl<F, S, Request> MatchFn<S, Request, ((), (), (), (), (), Context<S>)> for F
where F: Fn(&Context<S>) -> bool + Send + Sync + 'static,

§

impl<F, S, Request> MatchFn<S, Request, (Context<S>, Request)> for F
where F: Fn(&Context<S>, &Request) -> bool + Send + Sync + 'static,

§

impl<F, S, Request> MatchFn<S, Request, (Request,)> for F
where F: Fn(&Request) -> bool + Send + Sync + 'static,

§

impl<F, S, Request> MatchFn<S, Request, ()> for F
where F: Fn() -> bool + Send + Sync + 'static,