commit | dcb3d79baf933eedb7d77d957fc278eb50062d88 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <[email protected]> | Thu Aug 08 01:14:54 2024 +0000 |
committer | Android Build Coastguard Worker <[email protected]> | Thu Aug 08 01:14:54 2024 +0000 |
tree | f8433054006ec71b7bd3b147969274761558b45d | |
parent | 1ea4e8d89ca9355236c30dd05490cf8472a4abfe [diff] | |
parent | b40ab9cff1b71ee630d955793467e899022bc6a7 [diff] |
Snap for 12199973 from b40ab9cff1b71ee630d955793467e899022bc6a7 to 24Q4-release Change-Id: I48848ebabaa6db755273e2384bd56072bffe0443
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.