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

Commit 80e4e55

Browse files
committed
rename Fut to ResponseFuture
1 parent 9cad3a4 commit 80e4e55

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

examples/simple_response.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ impl Server {
2222
impl HttpService for Server {
2323
type Connection = ();
2424
type ConnectionFuture = future::Ready<Result<(), std::io::Error>>;
25-
type Fut = FutureObj<'static, Result<http_service::Response, std::io::Error>>;
25+
type ResponseFuture = FutureObj<'static, Result<http_service::Response, std::io::Error>>;
2626

2727
fn connect(&self) -> Self::ConnectionFuture {
2828
future::ok(())
2929
}
3030

31-
fn respond(&self, _conn: &mut (), _req: http_service::Request) -> Self::Fut {
31+
fn respond(&self, _conn: &mut (), _req: http_service::Request) -> Self::ResponseFuture {
3232
let message = self.message.clone();
3333
FutureObj::new(Box::new(async move {
3434
Ok(Response::new(http_service::Body::from(message)))

src/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131
//! impl HttpService for Server {
3232
//! type Connection = ();
3333
//! type ConnectionFuture = future::Ready<Result<(), std::io::Error>>;
34-
//! type Fut = FutureObj<'static, Result<http_service::Response, std::io::Error>>;
34+
//! type ResponseFuture = FutureObj<'static, Result<http_service::Response, std::io::Error>>;
3535
//!
3636
//! fn connect(&self) -> Self::ConnectionFuture {
3737
//! future::ok(())
3838
//! }
3939
//!
40-
//! fn respond(&self, _conn: &mut (), _req: http_service::Request) -> Self::Fut {
40+
//! fn respond(&self, _conn: &mut (), _req: http_service::Request) -> Self::ResponseFuture {
4141
//! let message = self.message.clone();
4242
//! FutureObj::new(Box::new(
4343
//! async move {
@@ -164,29 +164,29 @@ pub trait HttpService: Send + Sync + 'static {
164164
/// Returning an error will result in the server immediately dropping
165165
/// the connection. It is usually preferable to instead return an HTTP response
166166
/// with an error status code.
167-
type Fut: Send + 'static + TryFuture<Ok = Response>;
167+
type ResponseFuture: Send + 'static + TryFuture<Ok = Response>;
168168

169169
/// Begin handling a single request.
170170
///
171171
/// The handler is given shared access to the service itself, and mutable access
172172
/// to the state for the connection where the request is taking place.
173-
fn respond(&self, conn: &mut Self::Connection, req: Request) -> Self::Fut;
173+
fn respond(&self, conn: &mut Self::Connection, req: Request) -> Self::ResponseFuture;
174174
}
175175

176-
impl<F, Fut> HttpService for F
176+
impl<F, R> HttpService for F
177177
where
178-
F: Send + Sync + 'static + Fn(Request) -> Fut,
179-
Fut: Send + 'static + TryFuture<Ok = Response>,
180-
Fut::Error: Send,
178+
F: Send + Sync + 'static + Fn(Request) -> R,
179+
R: Send + 'static + TryFuture<Ok = Response>,
180+
R::Error: Send,
181181
{
182182
type Connection = ();
183-
type ConnectionFuture = future::Ready<Result<(), Fut::Error>>;
183+
type ConnectionFuture = future::Ready<Result<(), R::Error>>;
184184
fn connect(&self) -> Self::ConnectionFuture {
185185
future::ok(())
186186
}
187187

188-
type Fut = Fut;
189-
fn respond(&self, _: &mut (), req: Request) -> Self::Fut {
188+
type ResponseFuture = R;
189+
fn respond(&self, _: &mut (), req: Request) -> Self::ResponseFuture {
190190
(self)(req)
191191
}
192192
}

0 commit comments

Comments
 (0)