Skip to content

Commit e936399

Browse files
committed
chore: rename service::http::HttpService to service::tower_http::TowerHttpService
1 parent 48e7d96 commit e936399

File tree

5 files changed

+25
-26
lines changed

5 files changed

+25
-26
lines changed

src/proto/h1/dispatch.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ pub(crate) trait Dispatch {
3636
}
3737

3838
cfg_server! {
39-
use crate::service::HttpService;
39+
use crate::service::TowerHttpService;
4040

41-
pub(crate) struct Server<S: HttpService<B>, B> {
41+
pub(crate) struct Server<S: TowerHttpService<B>, B> {
4242
in_flight: Pin<Box<Option<S::Future>>>,
4343
pub(crate) service: S,
4444
}
@@ -454,7 +454,7 @@ impl<'a, T> Drop for OptGuard<'a, T> {
454454
cfg_server! {
455455
impl<S, B> Server<S, B>
456456
where
457-
S: HttpService<B>,
457+
S: TowerHttpService<B>,
458458
{
459459
pub(crate) fn new(service: S) -> Server<S, B> {
460460
Server {
@@ -469,11 +469,11 @@ cfg_server! {
469469
}
470470

471471
// Service is never pinned
472-
impl<S: HttpService<B>, B> Unpin for Server<S, B> {}
472+
impl<S: TowerHttpService<B>, B> Unpin for Server<S, B> {}
473473

474474
impl<S, Bs> Dispatch for Server<S, Body>
475475
where
476-
S: HttpService<Body, ResBody = Bs>,
476+
S: TowerHttpService<Body, ResBody = Bs>,
477477
S::Error: Into<Box<dyn StdError + Send + Sync>>,
478478
Bs: HttpBody,
479479
{

src/proto/h2/server.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use crate::headers;
2020
use crate::proto::h2::ping::Recorder;
2121
use crate::proto::h2::{H2Upgraded, UpgradedSendStream};
2222
use crate::proto::Dispatched;
23-
use crate::service::HttpService;
23+
use crate::service::TowerHttpService;
2424

2525
use crate::upgrade::{OnUpgrade, Pending, Upgraded};
2626
use crate::{Body, Response};
@@ -76,7 +76,7 @@ impl Default for Config {
7676
pin_project! {
7777
pub(crate) struct Server<T, S, B, E>
7878
where
79-
S: HttpService<Body>,
79+
S: TowerHttpService<Body>,
8080
B: HttpBody,
8181
{
8282
exec: E,
@@ -109,7 +109,7 @@ where
109109
impl<T, S, B, E> Server<T, S, B, E>
110110
where
111111
T: AsyncRead + AsyncWrite + Unpin,
112-
S: HttpService<Body, ResBody = B>,
112+
S: TowerHttpService<Body, ResBody = B>,
113113
S::Error: Into<Box<dyn StdError + Send + Sync>>,
114114
B: HttpBody + 'static,
115115
E: ConnStreamExec<S::Future, B>,
@@ -181,7 +181,7 @@ where
181181
impl<T, S, B, E> Future for Server<T, S, B, E>
182182
where
183183
T: AsyncRead + AsyncWrite + Unpin,
184-
S: HttpService<Body, ResBody = B>,
184+
S: TowerHttpService<Body, ResBody = B>,
185185
S::Error: Into<Box<dyn StdError + Send + Sync>>,
186186
B: HttpBody + 'static,
187187
E: ConnStreamExec<S::Future, B>,
@@ -236,7 +236,7 @@ where
236236
exec: &mut E,
237237
) -> Poll<crate::Result<()>>
238238
where
239-
S: HttpService<Body, ResBody = B>,
239+
S: TowerHttpService<Body, ResBody = B>,
240240
S::Error: Into<Box<dyn StdError + Send + Sync>>,
241241
E: ConnStreamExec<S::Future, B>,
242242
{

src/server/conn.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ cfg_feature! {
7272
use crate::common::Never;
7373
use crate::common::exec::{ConnStreamExec, Exec};
7474
use crate::proto;
75-
use crate::service::HttpService;
75+
use crate::service::TowerHttpService;
7676

7777
pub(super) use self::upgrades::UpgradeableConnection;
7878
}
@@ -123,7 +123,7 @@ pin_project! {
123123
#[cfg_attr(docsrs, doc(cfg(any(feature = "http1", feature = "http2"))))]
124124
pub struct Connection<T, S, E = Exec>
125125
where
126-
S: HttpService<Body>,
126+
S: TowerHttpService<Body>,
127127
{
128128
pub(super) conn: Option<ProtoServer<T, S::ResBody, S, E>>,
129129
fallback: Fallback<E>,
@@ -151,7 +151,7 @@ pin_project! {
151151
#[project = ProtoServerProj]
152152
pub(super) enum ProtoServer<T, B, S, E = Exec>
153153
where
154-
S: HttpService<Body>,
154+
S: TowerHttpService<Body>,
155155
B: HttpBody,
156156
{
157157
H1 {
@@ -598,7 +598,7 @@ impl<E> Http<E> {
598598
/// ```
599599
pub fn serve_connection<S, I, Bd>(&self, io: I, service: S) -> Connection<I, S, E>
600600
where
601-
S: HttpService<Body, ResBody = Bd>,
601+
S: TowerHttpService<Body, ResBody = Bd>,
602602
S::Error: Into<Box<dyn StdError + Send + Sync>>,
603603
Bd: HttpBody + 'static,
604604
Bd::Error: Into<Box<dyn StdError + Send + Sync>>,
@@ -678,7 +678,7 @@ impl<E> Http<E> {
678678
#[cfg(any(feature = "http1", feature = "http2"))]
679679
impl<I, B, S, E> Connection<I, S, E>
680680
where
681-
S: HttpService<Body, ResBody = B>,
681+
S: TowerHttpService<Body, ResBody = B>,
682682
S::Error: Into<Box<dyn StdError + Send + Sync>>,
683683
I: AsyncRead + AsyncWrite + Unpin,
684684
B: HttpBody + 'static,
@@ -848,7 +848,7 @@ where
848848
#[cfg(any(feature = "http1", feature = "http2"))]
849849
impl<I, B, S, E> Future for Connection<I, S, E>
850850
where
851-
S: HttpService<Body, ResBody = B>,
851+
S: TowerHttpService<Body, ResBody = B>,
852852
S::Error: Into<Box<dyn StdError + Send + Sync>>,
853853
I: AsyncRead + AsyncWrite + Unpin + 'static,
854854
B: HttpBody + 'static,
@@ -895,7 +895,7 @@ where
895895
#[cfg(any(feature = "http1", feature = "http2"))]
896896
impl<I, S> fmt::Debug for Connection<I, S>
897897
where
898-
S: HttpService<Body>,
898+
S: TowerHttpService<Body>,
899899
{
900900
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
901901
f.debug_struct("Connection").finish()
@@ -928,7 +928,7 @@ impl Default for ConnectionMode {
928928
impl<T, B, S, E> Future for ProtoServer<T, B, S, E>
929929
where
930930
T: AsyncRead + AsyncWrite + Unpin,
931-
S: HttpService<Body, ResBody = B>,
931+
S: TowerHttpService<Body, ResBody = B>,
932932
S::Error: Into<Box<dyn StdError + Send + Sync>>,
933933
B: HttpBody + 'static,
934934
B::Error: Into<Box<dyn StdError + Send + Sync>>,
@@ -963,14 +963,14 @@ mod upgrades {
963963
#[allow(missing_debug_implementations)]
964964
pub struct UpgradeableConnection<T, S, E>
965965
where
966-
S: HttpService<Body>,
966+
S: TowerHttpService<Body>,
967967
{
968968
pub(super) inner: Connection<T, S, E>,
969969
}
970970

971971
impl<I, B, S, E> UpgradeableConnection<I, S, E>
972972
where
973-
S: HttpService<Body, ResBody = B>,
973+
S: TowerHttpService<Body, ResBody = B>,
974974
S::Error: Into<Box<dyn StdError + Send + Sync>>,
975975
I: AsyncRead + AsyncWrite + Unpin,
976976
B: HttpBody + 'static,
@@ -988,7 +988,7 @@ mod upgrades {
988988

989989
impl<I, B, S, E> Future for UpgradeableConnection<I, S, E>
990990
where
991-
S: HttpService<Body, ResBody = B>,
991+
S: TowerHttpService<Body, ResBody = B>,
992992
S::Error: Into<Box<dyn StdError + Send + Sync>>,
993993
I: AsyncRead + AsyncWrite + Unpin + Send + 'static,
994994
B: HttpBody + 'static,

src/service/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@
2121
//! if you need to implement `Service` for a type manually, you can follow the example
2222
//! in `service_struct_impl.rs`.
2323
24-
mod http;
24+
mod tower_http;
2525
mod service;
2626
mod util;
2727

28-
#[cfg(all(any(feature = "http1", feature = "http2"), feature = "server"))]
29-
pub(super) use self::http::HttpService;
28+
pub(super) use self::tower_http::TowerHttpService;
3029

3130
pub use self::util::service_fn;

src/service/http.rs renamed to src/service/tower_http.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::common::{task, Future, Poll};
55
use crate::{Request, Response};
66

77
/// An asynchronous function from `Request` to `Response`.
8-
pub trait HttpService<ReqBody>: sealed::Sealed<ReqBody> {
8+
pub trait TowerHttpService<ReqBody>: sealed::Sealed<ReqBody> {
99
/// The `HttpBody` body of the `http::Response`.
1010
type ResBody: HttpBody;
1111

@@ -26,7 +26,7 @@ pub trait HttpService<ReqBody>: sealed::Sealed<ReqBody> {
2626
fn call(&mut self, req: Request<ReqBody>) -> Self::Future;
2727
}
2828

29-
impl<T, B1, B2> HttpService<B1> for T
29+
impl<T, B1, B2> TowerHttpService<B1> for T
3030
where
3131
T: tower_service::Service<Request<B1>, Response = Response<B2>>,
3232
B2: HttpBody,

0 commit comments

Comments
 (0)