Struct sharp_pencil::routing::Rule
source · [−]pub struct Rule {
pub matcher: Matcher,
pub methods: HashSet<Method>,
pub endpoint: String,
pub provide_automatic_options: bool,
}
Expand description
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
Implementations
sourceimpl Rule
impl Rule
sourcepub fn new(matcher: Matcher, methods: &[Method], endpoint: &str) -> Rule
pub 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.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Rule
impl Send for Rule
impl Sync for Rule
impl Unpin for Rule
impl UnwindSafe for Rule
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more