1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use crateState;
/// Exposes the `Endpoint` trait if you want to implement it for custom types.
///
/// This is not usually necessary since it's implemented for function types already.
use crate::;
use async_trait;
use Future;
/// Implement `Endpoint` for a type to be used as a method handler.
///
/// It is already implemented for functions of `Request` to `Result<Response>`
/// which is the simplest (and most convenient) kind of handler.
/// You can implement it manually for endpoints that may require some kind of local state.
///
/// `Endpoint` uses the `#[async_trait]` attribute hence the signature presented in the docs here
/// has been modified. An example of implementing using the attribute:
/// ```rust
/// # use highnoon::{Endpoint, State, Result, Request, Response};
/// struct NoOpEndpoint;
///
/// #[async_trait::async_trait]
/// impl<S: State> Endpoint<S> for NoOpEndpoint
/// {
/// async fn call(&self, req: Request<S>) -> Result<Response> {
/// Ok(Response::ok())
/// }
/// }
/// ```