Struct actix_web::dev::Router
[−]
[src]
pub struct Router(_);
Interface for application router.
Methods
impl Router
[src]
pub fn new<S>(
prefix: &str,
settings: ServerSettings,
map: Vec<(Resource, Option<ResourceHandler<S>>)>
) -> (Router, Vec<ResourceHandler<S>>)
[src]
prefix: &str,
settings: ServerSettings,
map: Vec<(Resource, Option<ResourceHandler<S>>)>
) -> (Router, Vec<ResourceHandler<S>>)
Create new router
pub fn prefix(&self) -> &str
[src]
Router prefix
pub fn server_settings(&self) -> &ServerSettings
[src]
Server settings
pub fn recognize<S>(&self, req: &mut HttpRequest<S>) -> Option<usize>
[src]
Query for matched resource
pub fn has_route(&self, path: &str) -> bool
[src]
Check if application contains matching route.
This method does not take prefix
into account.
For example if prefix is /test
and router contains route /name
,
following path would be recognizable /test/name
but has_route()
call
would return false
.
pub fn resource_path<U, I>(
&self,
name: &str,
elements: U
) -> Result<String, UrlGenerationError> where
U: IntoIterator<Item = I>,
I: AsRef<str>,
[src]
&self,
name: &str,
elements: U
) -> Result<String, UrlGenerationError> where
U: IntoIterator<Item = I>,
I: AsRef<str>,
Build named resource path.
Check [HttpRequest::url_for()
](../struct.HttpRequest.html#method.
url_for) for detailed information.