Struct rocket::Route
[−]
[src]
pub struct Route {
pub method: Method,
pub handler: Handler,
pub path: URI<'static>,
pub rank: isize,
pub format: Option<ContentType>,
}A route: a method, its handler, path, rank, and format/content type.
Fields
method: Method
The method this route matches against.
handler: Handler
A function that should be called when the route matches.
path: URI<'static>
The path (in Rocket format) that should be matched against.
rank: isize
The rank of this route. Lower ranks have higher priorities.
format: Option<ContentType>
The Content-Type this route matches against.
Methods
impl Route[src]
fn new<S>(m: Method, path: S, handler: Handler) -> Route where
S: AsRef<str>,
S: AsRef<str>,
Creates a new route with the method, path, and handler.
The rank of the route will be 0 if the path contains no dynamic
segments, and 1 if it does.
fn ranked<S>(rank: isize, m: Method, path: S, handler: Handler) -> Route where
S: AsRef<str>,
S: AsRef<str>,
Creates a new route with the given rank, method, path, and handler.
fn set_path<S>(&mut self, path: S) where
S: AsRef<str>,
S: AsRef<str>,
Sets the path of the route. Does not update the rank or any other parameters.
Trait Implementations
impl Clone for Route[src]
fn clone(&self) -> Route
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more