Struct ntex_router::ResourceDef
source · 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 ResourceDef
instance.
Path segments are separatted by /
. Pattern must start
with segment separator. Static segments could be
case insensitive.
Panics if path pattern is malformed.
sourcepub fn prefix<T: IntoPattern>(path: T) -> Self
pub fn prefix<T: IntoPattern>(path: T) -> Self
Parse path pattern and create new ResourceDef
instance.
Use prefix
type instead of static
.
Panics if path regex pattern is malformed.
sourcepub fn root_prefix<T: IntoPattern>(path: T) -> Self
pub fn root_prefix<T: IntoPattern>(path: T) -> Self
Parse path pattern and create new ResourceDef
instance.
Inserts /
to the start of the pattern.
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 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
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ResourceDef
impl Debug for ResourceDef
source§impl<'a> From<&'a str> for ResourceDef
impl<'a> From<&'a str> for ResourceDef
source§fn from(path: &'a str) -> ResourceDef
fn from(path: &'a str) -> ResourceDef
Converts to this type from the input type.
source§impl From<String> for ResourceDef
impl From<String> for ResourceDef
source§fn from(path: String) -> ResourceDef
fn from(path: String) -> ResourceDef
Converts to this type from the input type.
source§impl Hash for ResourceDef
impl Hash for ResourceDef
source§impl PartialEq for ResourceDef
impl PartialEq for ResourceDef
source§fn eq(&self, other: &ResourceDef) -> bool
fn eq(&self, other: &ResourceDef) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for ResourceDef
Auto Trait Implementations§
impl RefUnwindSafe for ResourceDef
impl Send for ResourceDef
impl Sync for ResourceDef
impl Unpin for ResourceDef
impl UnwindSafe for ResourceDef
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more