Struct actix_web::dev::ResourceMap
source · [−]pub struct ResourceMap { /* private fields */ }
Implementations
sourceimpl ResourceMap
impl ResourceMap
sourcepub fn new(root: ResourceDef) -> Self
pub fn new(root: ResourceDef) -> Self
Creates a container node in the ResourceMap
tree.
sourcepub fn add(
&mut self,
pattern: &mut ResourceDef,
nested: Option<Rc<ResourceMap>>
)
pub fn add(
&mut self,
pattern: &mut ResourceDef,
nested: Option<Rc<ResourceMap>>
)
Adds a (possibly nested) resource.
To add a non-prefix pattern, nested
must be None
.
To add external resource, supply a pattern without a leading /
.
The root pattern of nested
, if present, should match pattern
.
sourcepub fn url_for<U, I>(
&self,
req: &HttpRequest,
name: &str,
elements: U
) -> Result<Url, UrlGenerationError> where
U: IntoIterator<Item = I>,
I: AsRef<str>,
pub fn url_for<U, I>(
&self,
req: &HttpRequest,
name: &str,
elements: U
) -> Result<Url, UrlGenerationError> where
U: IntoIterator<Item = I>,
I: AsRef<str>,
Generate url for named resource
Check HttpRequest::url_for
for detailed information.
pub fn has_resource(&self, path: &str) -> bool
sourcepub fn match_name(&self, path: &str) -> Option<&str>
pub fn match_name(&self, path: &str) -> Option<&str>
Returns the name of the route that matches the given path or None if no full match is possible or the matching resource is not named.
sourcepub fn match_pattern(&self, path: &str) -> Option<String>
pub fn match_pattern(&self, path: &str) -> Option<String>
Returns the full resource pattern matched against a path or None if no full match is possible.
Trait Implementations
sourceimpl Clone for ResourceMap
impl Clone for ResourceMap
sourcefn clone(&self) -> ResourceMap
fn clone(&self) -> ResourceMap
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 more
Auto Trait Implementations
impl !RefUnwindSafe for ResourceMap
impl !Send for ResourceMap
impl !Sync for ResourceMap
impl Unpin for ResourceMap
impl !UnwindSafe for ResourceMap
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
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more