File tree Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -7,14 +7,22 @@ use std::{
77
88use super :: Oneshot ;
99
10- /// A tower service converted into a hyper service.
10+ /// A tower [`Service`][tower-svc] converted into a hyper [`Service`][hyper-svc].
11+ ///
12+ /// This wraps an inner tower service `S` in a [`hyper::service::Service`] implementation. See
13+ /// the module-level documentation of [`service`][crate::service] for more information about using
14+ /// [`tower`][tower] services and middleware with [`hyper`].
15+ ///
16+ /// [hyper-svc]: hyper::service::Service
17+ /// [tower]: https://docs.rs/tower/latest/tower/
18+ /// [tower-svc]: https://docs.rs/tower/latest/tower/trait.Service.html
1119#[ derive( Debug , Copy , Clone ) ]
1220pub struct TowerToHyperService < S > {
1321 service : S ,
1422}
1523
1624impl < S > TowerToHyperService < S > {
17- /// Create a new `TowerToHyperService` from a tower service.
25+ /// Create a new [ `TowerToHyperService`] from a tower service.
1826 pub fn new ( tower_service : S ) -> Self {
1927 Self {
2028 service : tower_service,
3947
4048pin_project ! {
4149 /// Response future for [`TowerToHyperService`].
50+ ///
51+ /// This future is acquired by [`call`][hyper::service::Service::call]ing a
52+ /// [`TowerToHyperService`].
4253 pub struct TowerToHyperServiceFuture <S , R >
4354 where
4455 S : tower_service:: Service <R >,
Original file line number Diff line number Diff line change 11//! Service utilities.
2+ //!
3+ //! [`hyper::service`] provides a [`Service`][hyper-svc] trait, representing an asynchronous
4+ //! function from a `Request` to a `Response`. This provides an interface allowing middleware for
5+ //! network application to be written in a modular and reusable way.
6+ //!
7+ //! This submodule provides an assortment of utilities for working with [`Service`][hyper-svc]s.
8+ //! See the module-level documentation of [`hyper::service`] for more information.
9+ //!
10+ //! # Tower
11+ //!
12+ //! While [`hyper`] uses its own notion of a [`Service`][hyper-svc] internally, many other
13+ //! libraries use a library such as [`tower`][tower] to provide the fundamental model of an
14+ //! asynchronous function.
15+ //!
16+ //! The [`TowerToHyperService`] type provided by this submodule can be used to bridge these
17+ //! ecosystems together. By wrapping a [`tower::Service`][tower-svc] in [`TowerToHyperService`],
18+ //! it can be passed into [`hyper`] interfaces that expect a [`hyper::service::Service`].
19+ //!
20+ //! [hyper-svc]: hyper::service::Service
21+ //! [tower]: https://docs.rs/tower/latest/tower/
22+ //! [tower-svc]: https://docs.rs/tower/latest/tower/trait.Service.html
223
324#[ cfg( feature = "service" ) ]
425mod glue;
You can’t perform that action at this time.
0 commit comments