#tower #service #async #error #server

tower-service

Trait representing an asynchronous, request / response based, client or server

7 unstable releases

0.3.1 Jan 23, 2021
0.3.0 Nov 29, 2019
0.3.0-alpha.2 Sep 30, 2019
0.3.0-alpha.1 Aug 20, 2019
0.0.0 Feb 19, 2018

#98 in Network programming

Download history 139926/week @ 2020-11-10 151368/week @ 2020-11-17 124753/week @ 2020-11-24 147151/week @ 2020-12-01 147052/week @ 2020-12-08 142968/week @ 2020-12-15 99908/week @ 2020-12-22 105281/week @ 2020-12-29 166636/week @ 2021-01-05 169286/week @ 2021-01-12 174616/week @ 2021-01-19 196289/week @ 2021-01-26 203003/week @ 2021-02-02 206436/week @ 2021-02-09 231209/week @ 2021-02-16 214876/week @ 2021-02-23

609,927 downloads per month
Used in 2,990 crates (70 directly)

MIT license

15KB

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