pub struct ResourceDef { /* private fields */ }
Expand description
ResourceDef describes an entry in resources table
Resource definition can contain only 16 dynamic segments
Implementations§
Source§impl ResourceDef
impl ResourceDef
Sourcepub fn new<T: IntoPattern>(path: T) -> Self
pub fn new<T: IntoPattern>(path: T) -> Self
Parse path pattern and create new Pattern
instance.
Panics if path pattern is malformed.
Sourcepub fn prefix(path: &str) -> Self
pub fn prefix(path: &str) -> Self
Parse path pattern and create new Pattern
instance.
Use prefix
type instead of static
.
Panics if path regex pattern is malformed.
Sourcepub fn root_prefix(path: &str) -> Self
pub fn root_prefix(path: &str) -> Self
Parse path pattern and create new Pattern
instance.
Inserts /
to begging of the pattern.
Use prefix
type instead of static
.
Panics if path regex pattern is malformed.
Sourcepub fn name_mut(&mut self) -> &mut String
pub fn name_mut(&mut self) -> &mut String
Mutable reference to a name of a resource definition.
Sourcepub fn is_prefix_match(&self, path: &str) -> Option<usize>
pub fn is_prefix_match(&self, path: &str) -> Option<usize>
Is prefix path a match against this resource?
Sourcepub fn match_path<T: ResourcePath>(&self, path: &mut Path<T>) -> bool
pub fn match_path<T: ResourcePath>(&self, path: &mut Path<T>) -> bool
Is the given path and parameters a match against this pattern?
Sourcepub fn match_path_checked<R, T, F, U>(
&self,
res: &mut R,
check: &F,
user_data: &Option<U>,
) -> bool
pub fn match_path_checked<R, T, F, U>( &self, res: &mut R, check: &F, user_data: &Option<U>, ) -> bool
Is the given path and parameters a match against this pattern?
Sourcepub fn resource_path<U, I>(&self, path: &mut String, elements: &mut U) -> bool
pub fn resource_path<U, I>(&self, path: &mut String, elements: &mut U) -> bool
Build resource path from elements. Returns true
on success.
Trait Implementations§
Source§impl Clone for ResourceDef
impl Clone for ResourceDef
Source§fn clone(&self) -> ResourceDef
fn clone(&self) -> ResourceDef
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more