Struct mount::Mount
[−]
[src]
pub struct Mount { /* fields omitted */ }
Mount
is a simple mounting middleware.
Mounting allows you to install a handler on a route and have it receive requests as if they
are relative to that route. For example, a handler mounted on /foo/
will receive
requests like /foo/bar
as if they are just /bar
. Iron's mounting middleware allows
you to specify multiple mountings using one middleware instance. Requests that pass through
the mounting middleware are passed along to the mounted handler that best matches the request's
path. Request::url
is modified so that requests appear to be relative to the mounted handler's route.
Mounted handlers may also access the original URL by requesting the OriginalUrl
key
from Request::extensions
.
Methods
impl Mount
[src]
fn new() -> Mount
Creates a new instance of Mount
.
fn mount<H: Handler>(&mut self, route: &str, handler: H) -> &mut Mount
Mounts a given Handler
onto a route.
This method may be called multiple times with different routes. For a given request, the most specific handler will be selected.
Existing handlers on the same route will be overwritten.
Trait Implementations
impl Handler for Mount
[src]
fn handle(&self, req: &mut Request) -> IronResult<Response>
Produce a Response
from a Request, with the possibility of error.