Struct resty::Router
[−]
[src]
pub struct Router { /* fields omitted */ }
Resty router. TODO [ToDr] More docs
Methods
impl Router
[src]
fn new() -> Self
[src]
Creates a new instance of router.
fn routes(&self) -> String
[src]
Pretty-prints the endpoints handled by given router.
fn add(&mut self, prefix: &str, router: Router)
[src]
Compose with some other router under given prefix.
fn bind<T: ToSocketAddrs>(self, address: T) -> Result<Listening, Error>
[src]
Consume the router and start HTTP server on given address.
fn on<'a, F, I, R, E, D, P>(&mut self, method: Method, params: D, fun: F) where
F: Fn(Request<P::Params>) -> I + Sync + Send + 'static,
I: IntoFuture<Item = R, Error = E>,
R: Into<Response>,
E: Into<Error>,
D: Into<Params<'a, P>>,
P: Parser,
I::Future: 'static,
[src]
F: Fn(Request<P::Params>) -> I + Sync + Send + 'static,
I: IntoFuture<Item = R, Error = E>,
R: Into<Response>,
E: Into<Error>,
D: Into<Params<'a, P>>,
P: Parser,
I::Future: 'static,
Declare endpoint.
fn get<'a, F, I, R, E, D, P>(&mut self, prefix: D, fun: F) where
F: Fn(Request<P::Params>) -> I + Sync + Send + 'static,
I: IntoFuture<Item = R, Error = E>,
R: Into<Response>,
E: Into<Error>,
D: Into<Params<'a, P>>,
P: Parser,
I::Future: 'static,
[src]
F: Fn(Request<P::Params>) -> I + Sync + Send + 'static,
I: IntoFuture<Item = R, Error = E>,
R: Into<Response>,
E: Into<Error>,
D: Into<Params<'a, P>>,
P: Parser,
I::Future: 'static,
Declare GET endpoint.
fn post<'a, F, I, R, E, D, P>(&mut self, prefix: D, fun: F) where
F: Fn(Request<P::Params>) -> I + Sync + Send + 'static,
I: IntoFuture<Item = R, Error = E>,
R: Into<Response>,
E: Into<Error>,
D: Into<Params<'a, P>>,
P: Parser,
I::Future: 'static,
[src]
F: Fn(Request<P::Params>) -> I + Sync + Send + 'static,
I: IntoFuture<Item = R, Error = E>,
R: Into<Response>,
E: Into<Error>,
D: Into<Params<'a, P>>,
P: Parser,
I::Future: 'static,
Declare POST endpoint.
fn put<'a, F, I, R, E, D, P>(&mut self, prefix: D, fun: F) where
F: Fn(Request<P::Params>) -> I + Sync + Send + 'static,
I: IntoFuture<Item = R, Error = E>,
R: Into<Response>,
E: Into<Error>,
D: Into<Params<'a, P>>,
P: Parser,
I::Future: 'static,
[src]
F: Fn(Request<P::Params>) -> I + Sync + Send + 'static,
I: IntoFuture<Item = R, Error = E>,
R: Into<Response>,
E: Into<Error>,
D: Into<Params<'a, P>>,
P: Parser,
I::Future: 'static,
Declare PUT endpoint.
fn patch<'a, F, I, R, E, D, P>(&mut self, prefix: D, fun: F) where
F: Fn(Request<P::Params>) -> I + Sync + Send + 'static,
I: IntoFuture<Item = R, Error = E>,
R: Into<Response>,
E: Into<Error>,
D: Into<Params<'a, P>>,
P: Parser,
I::Future: 'static,
[src]
F: Fn(Request<P::Params>) -> I + Sync + Send + 'static,
I: IntoFuture<Item = R, Error = E>,
R: Into<Response>,
E: Into<Error>,
D: Into<Params<'a, P>>,
P: Parser,
I::Future: 'static,
Declare PATCH endpoint.
fn delete<'a, F, I, R, E, D, P>(&mut self, prefix: D, fun: F) where
F: Fn(Request<P::Params>) -> I + Sync + Send + 'static,
I: IntoFuture<Item = R, Error = E>,
R: Into<Response>,
E: Into<Error>,
D: Into<Params<'a, P>>,
P: Parser,
I::Future: 'static,
[src]
F: Fn(Request<P::Params>) -> I + Sync + Send + 'static,
I: IntoFuture<Item = R, Error = E>,
R: Into<Response>,
E: Into<Error>,
D: Into<Params<'a, P>>,
P: Parser,
I::Future: 'static,
Declare DELETE endpoint.