Struct actix_web::dev::ResourceDef
source · pub struct ResourceDef { /* private fields */ }
Expand description
Resource type describes an entry in resources table
Implementations
sourceimpl ResourceDef
impl ResourceDef
sourcepub fn new(path: &str) -> Self
pub fn new(path: &str) -> Self
Parse path pattern and create new ResourceDef
instance.
Panics if path pattern is wrong.
sourcepub fn prefix(path: &str) -> Self
pub fn prefix(path: &str) -> Self
Parse path pattern and create new ResourceDef
instance.
Use prefix
type instead of static
.
Panics if path regex pattern is wrong.
sourcepub fn external(path: &str) -> Self
pub fn external(path: &str) -> Self
Construct external resource def
Panics if path pattern is wrong.
sourcepub fn with_prefix(path: &str, for_prefix: bool, slash: bool) -> Self
pub fn with_prefix(path: &str, for_prefix: bool, slash: bool) -> Self
Parse path pattern and create new ResourceDef
instance with custom prefix
sourcepub fn rtype(&self) -> ResourceType
pub fn rtype(&self) -> ResourceType
Resource type
sourcepub fn match_with_params(&self, req: &Request, plen: usize) -> Option<Params>
pub fn match_with_params(&self, req: &Request, plen: usize) -> Option<Params>
Are the given path and parameters a match against this resource?
sourcepub fn match_prefix_with_params(
&self,
req: &Request,
plen: usize
) -> Option<Params>
pub fn match_prefix_with_params(
&self,
req: &Request,
plen: usize
) -> Option<Params>
Is the given path a prefix match and do the parameters match against this resource?
sourcepub fn resource_path<U, I>(
&self,
path: &mut String,
elements: &mut U
) -> Result<(), UrlGenerationError>where
U: Iterator<Item = I>,
I: AsRef<str>,
pub fn resource_path<U, I>(
&self,
path: &mut String,
elements: &mut U
) -> Result<(), UrlGenerationError>where
U: Iterator<Item = I>,
I: AsRef<str>,
Build resource path.
Trait Implementations
sourceimpl Clone for ResourceDef
impl Clone for ResourceDef
sourcefn clone(&self) -> ResourceDef
fn clone(&self) -> ResourceDef
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for ResourceDef
impl Debug for ResourceDef
sourceimpl Hash for ResourceDef
impl Hash for ResourceDef
sourceimpl PartialEq<ResourceDef> for ResourceDef
impl PartialEq<ResourceDef> for ResourceDef
sourcefn eq(&self, other: &ResourceDef) -> bool
fn eq(&self, other: &ResourceDef) -> bool
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.