[][src]Struct tide::Resource

pub struct Resource<'a, Data> { /* fields omitted */ }

A handle to a resource (identified by a path).

All HTTP requests are made against resources. After using Router::at (or App::at) to establish a resource path, the Resource 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.

After establishing an endpoint, the method will return &mut EndpointData. This can be used to set per-endpoint configuration.

Methods

impl<'a, Data> Resource<'a, Data>[src]

pub fn nest(
    self,
    builder: impl FnOnce(&mut Router<Data>)
)
[src]

"Nest" a subrouter to the path.

This method will build a fresh Router and give a mutable reference to it to the builder function. Builder can set up a subrouter using the Router. All middleware applied inside the builder will be local to the subrouter and its descendents.

If resources are already present, they will be discarded.

pub fn method<T: Endpoint<Data, U>, U>(
    &mut self,
    method: Method,
    ep: T
) -> &mut EndpointData<Data>
[src]

Add an endpoint for the given HTTP method

pub fn get<T: Endpoint<Data, U>, U>(&mut self, ep: T) -> &mut EndpointData<Data>[src]

Add an endpoint for GET requests

pub fn head<T: Endpoint<Data, U>, U>(
    &mut self,
    ep: T
) -> &mut EndpointData<Data>
[src]

Add an endpoint for HEAD requests

pub fn put<T: Endpoint<Data, U>, U>(&mut self, ep: T) -> &mut EndpointData<Data>[src]

Add an endpoint for PUT requests

pub fn post<T: Endpoint<Data, U>, U>(
    &mut self,
    ep: T
) -> &mut EndpointData<Data>
[src]

Add an endpoint for POST requests

pub fn delete<T: Endpoint<Data, U>, U>(
    &mut self,
    ep: T
) -> &mut EndpointData<Data>
[src]

Add an endpoint for DELETE requests

pub fn options<T: Endpoint<Data, U>, U>(
    &mut self,
    ep: T
) -> &mut EndpointData<Data>
[src]

Add an endpoint for OPTIONS requests

pub fn connect<T: Endpoint<Data, U>, U>(
    &mut self,
    ep: T
) -> &mut EndpointData<Data>
[src]

Add an endpoint for CONNECT requests

pub fn patch<T: Endpoint<Data, U>, U>(
    &mut self,
    ep: T
) -> &mut EndpointData<Data>
[src]

Add an endpoint for PATCH requests

pub fn trace<T: Endpoint<Data, U>, U>(
    &mut self,
    ep: T
) -> &mut EndpointData<Data>
[src]

Add an endpoint for TRACE requests

Auto Trait Implementations

impl<'a, Data> Send for Resource<'a, Data>

impl<'a, Data> Sync for Resource<'a, Data>

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

impl<T> Erased for T