Struct pencil::routing::Rule
[−]
[src]
pub struct Rule { pub matcher: Matcher, pub methods: HashSet<Method>, pub endpoint: String, pub provide_automatic_options: bool, }
A Rule represents one URL pattern.
Fields
matcher: Matcher
The matcher is used to match the url path.
methods: HashSet<Method>
A set of http methods this rule applies to.
endpoint: String
The endpoint for this rule.
provide_automatic_options: bool
Methods
impl Rule
[src]
fn new(matcher: Matcher, methods: &[Method], endpoint: &str) -> Rule
Create a new Rule
. Matcher basically are used to hold url
regular expressions. Rule endpoint is a string that is used for
URL generation. Rule methods is an array of http methods this rule
applies to, if GET
is present in it and HEAD
is not, HEAD
is
added automatically.
fn matched(&self, path: String) -> Option<Result<ViewArgs, RequestSlashError>>
Check if the rule matches a given path.
Trait Implementations
impl Clone for Rule
[src]
fn clone(&self) -> Rule
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