[][src]Struct tide::Route

pub struct Route<'a, State> { /* fields omitted */ }

A handle to a route.

All HTTP requests are made against resources. After using Server::at (or Route::at) to establish a route, the Route type can be used to establish endpoints for various HTTP methods at that path. Also, using nest, it can be used to set up a subrouter.

Methods

impl<'a, State: 'static> Route<'a, State>[src]

pub fn at<'b>(&'b mut self, path: &str) -> Route<'b, State>[src]

Extend the route with the given path.

pub fn strip_prefix(&mut self) -> &mut Self[src]

This is supported on unstable only.

Treat the current path as a prefix, and strip prefixes from requests.

This method is marked unstable as its name might change in the near future.

Endpoints will be given a path with the prefix removed.

pub fn nest<InnerState>(&mut self, service: Server<InnerState>) -> &mut Self where
    State: Send + Sync + 'static,
    InnerState: Send + Sync + 'static, 
[src]

Nest a Server at the current path.

pub fn method(&mut self, method: Method, ep: impl Endpoint<State>) -> &mut Self[src]

Add an endpoint for the given HTTP method

pub fn all(&mut self, ep: impl Endpoint<State>) -> &mut Self[src]

Add an endpoint for all HTTP methods, as a fallback.

Routes with specific HTTP methods will be tried first.

pub fn get(&mut self, ep: impl Endpoint<State>) -> &mut Self[src]

Add an endpoint for GET requests

pub fn head(&mut self, ep: impl Endpoint<State>) -> &mut Self[src]

Add an endpoint for HEAD requests

pub fn put(&mut self, ep: impl Endpoint<State>) -> &mut Self[src]

Add an endpoint for PUT requests

pub fn post(&mut self, ep: impl Endpoint<State>) -> &mut Self[src]

Add an endpoint for POST requests

pub fn delete(&mut self, ep: impl Endpoint<State>) -> &mut Self[src]

Add an endpoint for DELETE requests

pub fn options(&mut self, ep: impl Endpoint<State>) -> &mut Self[src]

Add an endpoint for OPTIONS requests

pub fn connect(&mut self, ep: impl Endpoint<State>) -> &mut Self[src]

Add an endpoint for CONNECT requests

pub fn patch(&mut self, ep: impl Endpoint<State>) -> &mut Self[src]

Add an endpoint for PATCH requests

pub fn trace(&mut self, ep: impl Endpoint<State>) -> &mut Self[src]

Add an endpoint for TRACE requests

Auto Trait Implementations

impl<'a, State> !RefUnwindSafe for Route<'a, State>

impl<'a, State> Send for Route<'a, State>

impl<'a, State> Sync for Route<'a, State>

impl<'a, State> Unpin for Route<'a, State>

impl<'a, State> !UnwindSafe for Route<'a, State>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.