[−][src]Struct tide::Resource
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]
self,
builder: impl FnOnce(&mut Router<Data>)
)
"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]
&mut self,
method: Method,
ep: T
) -> &mut EndpointData<Data>
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]
&mut self,
ep: T
) -> &mut EndpointData<Data>
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]
&mut self,
ep: T
) -> &mut EndpointData<Data>
Add an endpoint for POST
requests
pub fn delete<T: Endpoint<Data, U>, U>(
&mut self,
ep: T
) -> &mut EndpointData<Data>
[src]
&mut self,
ep: T
) -> &mut EndpointData<Data>
Add an endpoint for DELETE
requests
pub fn options<T: Endpoint<Data, U>, U>(
&mut self,
ep: T
) -> &mut EndpointData<Data>
[src]
&mut self,
ep: T
) -> &mut EndpointData<Data>
Add an endpoint for OPTIONS
requests
pub fn connect<T: Endpoint<Data, U>, U>(
&mut self,
ep: T
) -> &mut EndpointData<Data>
[src]
&mut self,
ep: T
) -> &mut EndpointData<Data>
Add an endpoint for CONNECT
requests
pub fn patch<T: Endpoint<Data, U>, U>(
&mut self,
ep: T
) -> &mut EndpointData<Data>
[src]
&mut self,
ep: T
) -> &mut EndpointData<Data>
Add an endpoint for PATCH
requests
pub fn trace<T: Endpoint<Data, U>, U>(
&mut self,
ep: T
) -> &mut EndpointData<Data>
[src]
&mut self,
ep: T
) -> &mut EndpointData<Data>
Add an endpoint for TRACE
requests
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,