commit | e1c1d1573522c765674c847489ee0554449b09fc | [log] [tgz] |
---|---|---|
author | Viktoriia Kovalova <[email protected]> | Fri May 24 17:28:55 2024 +0000 |
committer | Viktoriia Kovalova <[email protected]> | Fri May 24 17:43:22 2024 +0000 |
tree | e56219879aa5e286a4080850c4345386d4a13266 | |
parent | f34066705b5714ff1f5309599203f3aec5f7a1ba [diff] |
Import 'tower-service' crate Request Document: go/android-rust-importing-crates For CL Reviewers: go/android3p#cl-review For Build Team: go/ab-third-party-imports Bug: http://b/339177916 Test: m libtower_service Change-Id: Id5056b5227d2c3d81c88de414c245a09829d595d
The foundational Service
trait that Tower is based on.
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.
This project is licensed under the MIT license.
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.