9 releases

0.3.3 Aug 13, 2024
0.3.2 Jun 17, 2022
0.3.1 Jan 23, 2021
0.3.0 Nov 29, 2019
0.0.0 Feb 19, 2018

#341 in Network programming

Download history 1504591/week @ 2024-07-25 1509693/week @ 2024-08-01 1613401/week @ 2024-08-08 1638867/week @ 2024-08-15 1685640/week @ 2024-08-22 1568451/week @ 2024-08-29 1720574/week @ 2024-09-05 1626463/week @ 2024-09-12 1764544/week @ 2024-09-19 1898249/week @ 2024-09-26 2303030/week @ 2024-10-03 2235422/week @ 2024-10-10 2365530/week @ 2024-10-17 1865339/week @ 2024-10-24 1809955/week @ 2024-10-31 1755860/week @ 2024-11-07

8,162,069 downloads per month
Used in 20,621 crates (313 directly)

MIT license

19KB

Tower Service

The foundational Service trait that Tower is based on.

Crates.io Documentation Documentation (master) MIT licensed Build Status Discord chat

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.

License

This project is licensed under the MIT 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.

No runtime deps