Skip to content
This repository was archived by the owner on Jun 21, 2020. It is now read-only.

Commit d920d58

Browse files
committed
cargo fmt
Signed-off-by: Yoshua Wuyts <[email protected]>
1 parent 515d066 commit d920d58

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

http-service-hyper/src/lib.rs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55
#![warn(missing_docs, missing_doc_code_examples)]
66
#![cfg_attr(test, deny(warnings))]
77

8+
use futures::compat::Future01CompatExt;
89
#[cfg(feature = "runtime")]
910
use futures::compat::{Compat as Compat03As01, Compat01As03};
10-
use futures::compat::Future01CompatExt;
1111
use futures::future::BoxFuture;
1212
use futures::prelude::*;
1313
use futures::stream;
1414
use futures::task::Spawn;
1515
use http_service::{Body, HttpService};
1616
use hyper::server::{Builder as HyperBuilder, Server as HyperServer};
1717

18+
use std::io;
1819
#[cfg(feature = "runtime")]
1920
use std::net::SocketAddr;
2021
use std::pin::Pin;
2122
use std::sync::Arc;
2223
use std::task::{self, Context, Poll};
23-
use std::io;
2424

2525
// Wrapper type to allow us to provide a blanket `MakeService` impl
2626
struct WrapHttpService<H> {
@@ -33,14 +33,14 @@ struct WrapConnection<H: HttpService> {
3333
connection: H::Connection,
3434
}
3535

36-
impl<H, Ctx, > hyper::service::MakeService<Ctx> for WrapHttpService<H, >
36+
impl<H, Ctx> hyper::service::MakeService<Ctx> for WrapHttpService<H>
3737
where
3838
H: HttpService,
3939
{
4040
type ReqBody = hyper::Body;
4141
type ResBody = hyper::Body;
4242
type Error = std::io::Error;
43-
type Service = WrapConnection<H, >;
43+
type Service = WrapConnection<H>;
4444
type Future = Compat03As01<BoxFuture<'static, Result<Self::Service, Self::Error>>>;
4545
type MakeError = std::io::Error;
4646

@@ -59,14 +59,15 @@ where
5959
}
6060
}
6161

62-
impl<H, > hyper::service::Service for WrapConnection<H, >
62+
impl<H> hyper::service::Service for WrapConnection<H>
6363
where
6464
H: HttpService,
6565
{
6666
type ReqBody = hyper::Body;
6767
type ResBody = hyper::Body;
6868
type Error = std::io::Error;
69-
type Future = Compat03As01<BoxFuture<'static, Result<http::Response<hyper::Body>, Self::Error>>>;
69+
type Future =
70+
Compat03As01<BoxFuture<'static, Result<http::Response<hyper::Body>, Self::Error>>>;
7071

7172
fn call(&mut self, req: http::Request<hyper::Body>) -> Self::Future {
7273
// Convert Request
@@ -87,7 +88,9 @@ where
8788
let (parts, body) = res.into_parts();
8889
let body = hyper::Body::wrap_stream(Compat03As01::new(ChunkStream { body }));
8990
Ok(hyper::Response::from_parts(parts, body))
90-
}.boxed().compat()
91+
}
92+
.boxed()
93+
.compat()
9194
}
9295
}
9396

@@ -116,7 +119,10 @@ impl<I: TryStream, S, Sp> std::fmt::Debug for Server<I, S, Sp> {
116119
/// A builder for a [`Server`].
117120
#[allow(clippy::type_complexity)] // single-use type with many compat layers
118121
pub struct Builder<I: TryStream, Sp> {
119-
inner: HyperBuilder<Compat03As01<stream::MapOk<I, fn(I::Ok) -> Compat03As01<I::Ok>>>, Compat03As01<Sp>>,
122+
inner: HyperBuilder<
123+
Compat03As01<stream::MapOk<I, fn(I::Ok) -> Compat03As01<I::Ok>>>,
124+
Compat03As01<Sp>,
125+
>,
120126
}
121127

122128
impl<I: TryStream, Sp> std::fmt::Debug for Builder<I, Sp> {
@@ -170,7 +176,7 @@ impl<I: TryStream, Sp> Builder<I, Sp> {
170176
/// // Finally, spawn `server` onto our executor...
171177
/// pool.run(server)?;
172178
/// # Ok::<(), Box<dyn std::error::Error>>(())
173-
pub fn serve<S: HttpService, >(self, service: S) -> Server<I, S, Sp>
179+
pub fn serve<S: HttpService>(self, service: S) -> Server<I, S, Sp>
174180
where
175181
I: TryStream + Unpin,
176182
I::Ok: AsyncRead + AsyncWrite + Send + Unpin + 'static,
@@ -186,7 +192,7 @@ impl<I: TryStream, Sp> Builder<I, Sp> {
186192
}
187193
}
188194

189-
impl<I, S, Sp, > Future for Server<I, S, Sp>
195+
impl<I, S, Sp> Future for Server<I, S, Sp>
190196
where
191197
I: TryStream + Unpin,
192198
I::Ok: AsyncRead + AsyncWrite + Send + Unpin + 'static,
@@ -205,7 +211,7 @@ where
205211
/// Serve the given `HttpService` at the given address, using `hyper` as backend, and return a
206212
/// `Future` that can be `await`ed on.
207213
#[cfg(feature = "runtime")]
208-
pub fn serve<S: HttpService, >(
214+
pub fn serve<S: HttpService>(
209215
s: S,
210216
addr: SocketAddr,
211217
) -> impl Future<Output = Result<(), hyper::Error>> {

0 commit comments

Comments
 (0)