[][src]Macro match_request::match_request_regex

macro_rules! match_request_regex {
    ($request_method:expr, $request_path:expr, {
        $($pattern:expr => {
            $($method:ident => $result:expr),* $(,)?
        }),* $(,)?
    }) => { ... };
}

Like match_request! but each pattern is a raw Regex pattern. If you want to match entire URLs be sure to prefix each pattern with ^ and end with $ as no conversion is made before passing the pattern to Regexp::new() for compilation.

Intstead of returning a Params struct with the match path parameters, this macro will return the raw regexp::Captures.

Returns

Result<(T, regex::Captures<'t>), match_request::Error> where T is the type of the match arms, and the lifetime 't relates to the provided path argument.

Panics

If any of the regular expressions are invalid this macro will panic on first invocation.