#request-response #client-server #service-request #async-trait #tower #traits #foundation

tower-async-service

Trait representing an asynchronous, request / response based, client or server. An "Async Trait" fork from the original Tower Library

3 unstable releases

0.2.0 Nov 20, 2023
0.1.1 Jul 18, 2023
0.1.0 Jul 17, 2023

#8 in #service-request

Download history 42/week @ 2024-06-16 24/week @ 2024-06-23 42/week @ 2024-06-30 10/week @ 2024-07-07 20/week @ 2024-07-14 9/week @ 2024-07-21 32/week @ 2024-07-28 6/week @ 2024-08-04 11/week @ 2024-08-11 5/week @ 2024-08-18 16/week @ 2024-08-25 13/week @ 2024-09-01 20/week @ 2024-09-08 12/week @ 2024-09-15 24/week @ 2024-09-22 22/week @ 2024-09-29

79 downloads per month
Used in 5 crates

MIT license

13KB

Tower Async Service

The foundational Service trait that Tower Async is based on.

Crates.io Documentation MIT licensed Build Status

Fork

Tower Async Service is a fork of https://github.com/tower-rs/tower and makes use of async traits to simplify things and make it more easier to integrate async functions into middleware.

This fork is made entirely with the needs of the author in mind, and thus might not yet contain all features you might need.

Come join us at discord on the #tower-async public channel at Discord or tag @glendc at Tokio's Tower discord instead.

Where suitable we'll keep in sync (manually) with Tower and if the opportunity arises we'll contribute back "upstream" as well. Given however how big the diversange we aren't sure how likely that is.

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.

Big thanks and credits go towards the original Tower authors which licensed their code under the same License type.

Contribution

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

No runtime deps