pub trait Matcher: Send + Sync {
fn is_match(&self, segment: &str) -> bool;
fn capture<'a>(&'a self, _segment: &str) -> Option<Capture<'a>> { ... }
}
Expand description
Matching trait to enable generic route matching algorithms.
This trait backs the main tree, enabling custom segment matching based on the needs of the end developer. In many cases it’s wasteful to check for things like RegEx, especially when all routes will only be static (as an example).
Required Methods
Provided Methods
Implementors
impl Matcher for DynamicMatcher
impl Matcher for StaticMatcher
impl<F> Matcher for F where
F: Fn(&str) -> bool + Send + Sync,
Blanket implementation of Matcher
for pure functions.
Pure functions are assumed to not have a capture group, as there’s no way to directly name them at this point (unless derived from the input).