summaryrefslogtreecommitdiffstats
path: root/third_party/rust/tower-service/README.md
blob: 240649eb3f77eab55d019c3c40ddf28928b58dbe (plain)
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
# Tower Service

The foundational `Service` trait that Tower is based on.

## Overview

The [`Service`] trait provides the foundation upon which Tower is built. It is a
simple, but powerful trait. At its heart, `Service` is just an asynchronous
function of request to response.

```
async fn(Request) -> Result<Response, Error>
```

Implementations of `Service` take a request, the type of which varies per
protocol, and returns a future representing the eventual completion or failure
of the response.

Services are used to represent both clients and servers. An *instance* of
`Service` is used through a client; a server *implements* `Service`.

By using standardizing the interface, middleware can be created. Middleware
*implement* `Service` by passing the request to another `Service`. The
middleware may take actions such as modify the request.

[`Service`]: https://docs.rs/tower-service/latest/tower_service/trait.Service.html

## License

This project is licensed under the [MIT license](LICENSE).

### Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in Tower by you, shall be licensed as MIT, without any additional
terms or conditions.