Struct pencil::routing::Matcher [] [src]

pub struct Matcher {
    pub regex: Regex,
}

The matcher holds the url regex object.

Fields

regex: Regex

Methods

impl Matcher
[src]

fn new(regex: Regex) -> Matcher

Trait Implementations

impl Clone for Matcher
[src]

fn clone(&self) -> Matcher

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl<'a> From<&'a str> for Matcher
[src]

Rule strings basically are just normal URL paths with placeholders in the format <name:converter> where the converter are optional. Currently we support following converters:

If no converter is defined the default converter is used which means string.

URL rules that end with a slash are branch URLs, others are leaves. All branch URLs that are matched without a trailing slash will trigger a redirect to the same URL with the missing slash appended. We have a url without a trailing slash for branch url rule. So we redirect to the same url but with a trailing slash.

fn from(rule: &'a str) -> Matcher

Performs the conversion.

impl From<String> for Matcher
[src]

Same rule as &str.

fn from(rule: String) -> Matcher

Performs the conversion.

impl From<Regex> for Matcher
[src]

fn from(regex: Regex) -> Matcher

Performs the conversion.