8 releases

0.3.2 Jun 17, 2022
0.3.1 Jan 23, 2021
0.3.0 Nov 29, 2019
0.3.0-alpha.2 Sep 30, 2019
0.0.0 Feb 19, 2018

#189 in Network programming

Download history 955354/week @ 2023-12-17 556824/week @ 2023-12-24 866218/week @ 2023-12-31 1102505/week @ 2024-01-07 1148676/week @ 2024-01-14 1197824/week @ 2024-01-21 1266694/week @ 2024-01-28 1276516/week @ 2024-02-04 1281759/week @ 2024-02-11 1253514/week @ 2024-02-18 1343285/week @ 2024-02-25 1354009/week @ 2024-03-03 1278677/week @ 2024-03-10 1297079/week @ 2024-03-17 1284231/week @ 2024-03-24 1306554/week @ 2024-03-31

5,247,250 downloads per month
Used in 16,753 crates (837 directly)

MIT license

18KB

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