Skip to content

Commit a37e6b5

Browse files
committed
fix(lib): remove deprecated tokio-proto APIs
BREAKING CHANGE: Many of these APIs have been deprecated for a while, check the documentation for the recommended way to use hyper now.
1 parent dbfc45b commit a37e6b5

File tree

10 files changed

+10
-553
lines changed

10 files changed

+10
-553
lines changed

Cargo.toml

+1-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ percent-encoding = "1.0"
3535
relay = "0.1"
3636
time = "0.1"
3737
tokio-core = "0.1.11"
38-
tokio-proto = { version = "0.1", optional = true }
3938
tokio-service = "0.1"
4039
tokio-io = "0.1"
4140
unicase = "2.0"
@@ -47,8 +46,7 @@ spmc = "0.2"
4746
url = "1.0"
4847

4948
[features]
50-
default = ["server-proto"]
49+
default = []
5150
nightly = []
5251
raw_status = []
5352
compat = [ "http" ]
54-
server-proto = ["tokio-proto"]

src/client/mod.rs

-6
Original file line numberDiff line numberDiff line change
@@ -533,12 +533,6 @@ impl<C, B> Config<C, B> {
533533
self.set_host = val;
534534
self
535535
}
536-
537-
#[doc(hidden)]
538-
#[deprecated(since="0.11.11", note="no_proto is always enabled")]
539-
pub fn no_proto(self) -> Config<C, B> {
540-
self
541-
}
542536
}
543537

544538
impl<C, B> Config<C, B>

src/lib.rs

-15
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ extern crate relay;
3333
extern crate time;
3434
extern crate tokio_core as tokio;
3535
#[macro_use] extern crate tokio_io;
36-
#[cfg(feature = "tokio-proto")]
37-
extern crate tokio_proto;
3836
extern crate tokio_service;
3937
extern crate unicase;
4038

@@ -55,19 +53,6 @@ pub use version::HttpVersion;
5553
#[cfg(feature = "raw_status")]
5654
pub use proto::RawStatus;
5755

58-
macro_rules! feat_server_proto {
59-
($($i:item)*) => ($(
60-
#[cfg(feature = "server-proto")]
61-
#[deprecated(
62-
since="0.11.11",
63-
note="All usage of the tokio-proto crate is going away."
64-
)]
65-
#[doc(hidden)]
66-
#[allow(deprecated)]
67-
$i
68-
)*)
69-
}
70-
7156
mod common;
7257
#[cfg(test)]
7358
mod mock;

src/mock.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,11 @@ impl<T> AsyncIo<T> {
118118
self.park_tasks = enabled;
119119
}
120120

121-
#[cfg(feature = "tokio-proto")]
122-
//TODO: fix proto::conn::tests to not use tokio-proto API,
123-
//and then this cfg flag go away
121+
/*
124122
pub fn flushed(&self) -> bool {
125123
self.flushed
126124
}
125+
*/
127126

128127
pub fn blocked(&self) -> bool {
129128
self.blocked
@@ -148,12 +147,11 @@ impl AsyncIo<MockCursor> {
148147
AsyncIo::new(MockCursor::wrap(buf.into()), bytes)
149148
}
150149

151-
#[cfg(feature = "tokio-proto")]
152-
//TODO: fix proto::conn::tests to not use tokio-proto API,
153-
//and then this cfg flag go away
154-
pub fn new_eof() -> AsyncIo<MockCursor> {
155-
AsyncIo::new(MockCursor::wrap(Vec::new().into()), 1)
150+
/*
151+
pub fn new_eof() -> AsyncIo<Buf> {
152+
AsyncIo::new(Buf::wrap(Vec::new().into()), 1)
156153
}
154+
*/
157155

158156
fn close(&mut self) {
159157
self.block_in(1);

src/proto/body.rs

-44
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@ use std::fmt;
33
use bytes::Bytes;
44
use futures::{Async, AsyncSink, Future, Poll, Sink, StartSend, Stream};
55
use futures::sync::{mpsc, oneshot};
6-
#[cfg(feature = "tokio-proto")]
7-
use tokio_proto;
86
use std::borrow::Cow;
97

108
use super::Chunk;
119

12-
#[cfg(feature = "tokio-proto")]
13-
pub type TokioBody = tokio_proto::streaming::Body<Chunk, ::Error>;
1410
pub type BodySender = mpsc::Sender<Result<Chunk, ::Error>>;
1511

1612
/// A `Stream` for `Chunk`s used in requests and responses.
@@ -21,8 +17,6 @@ pub struct Body {
2117

2218
#[derive(Debug)]
2319
enum Kind {
24-
#[cfg(feature = "tokio-proto")]
25-
Tokio(TokioBody),
2620
Chan {
2721
close_tx: oneshot::Sender<bool>,
2822
rx: mpsc::Receiver<Result<Chunk, ::Error>>,
@@ -77,8 +71,6 @@ impl Body {
7771

7872
fn poll_inner(&mut self) -> Poll<Option<Chunk>, ::Error> {
7973
match self.kind {
80-
#[cfg(feature = "tokio-proto")]
81-
Kind::Tokio(ref mut rx) => rx.poll(),
8274
Kind::Chan { ref mut rx, .. } => match rx.poll().expect("mpsc cannot error") {
8375
Async::Ready(Some(Ok(chunk))) => Ok(Async::Ready(Some(chunk))),
8476
Async::Ready(Some(Err(err))) => Err(err),
@@ -160,42 +152,6 @@ impl ChunkSender {
160152
}
161153
}
162154

163-
feat_server_proto! {
164-
impl From<Body> for tokio_proto::streaming::Body<Chunk, ::Error> {
165-
fn from(b: Body) -> tokio_proto::streaming::Body<Chunk, ::Error> {
166-
match b.kind {
167-
Kind::Tokio(b) => b,
168-
Kind::Chan { close_tx, rx } => {
169-
// disable knowing if the Rx gets dropped, since we cannot
170-
// pass this tx along.
171-
let _ = close_tx.send(false);
172-
rx.into()
173-
},
174-
Kind::Once(Some(chunk)) => TokioBody::from(chunk),
175-
Kind::Once(None) |
176-
Kind::Empty => TokioBody::empty(),
177-
}
178-
}
179-
}
180-
181-
impl From<tokio_proto::streaming::Body<Chunk, ::Error>> for Body {
182-
fn from(tokio_body: tokio_proto::streaming::Body<Chunk, ::Error>) -> Body {
183-
Body::new(Kind::Tokio(tokio_body))
184-
}
185-
}
186-
}
187-
188-
impl From<mpsc::Receiver<Result<Chunk, ::Error>>> for Body {
189-
#[inline]
190-
fn from(src: mpsc::Receiver<Result<Chunk, ::Error>>) -> Body {
191-
let (tx, _) = oneshot::channel();
192-
Body::new(Kind::Chan {
193-
close_tx: tx,
194-
rx: src,
195-
})
196-
}
197-
}
198-
199155
impl From<Chunk> for Body {
200156
#[inline]
201157
fn from (chunk: Chunk) -> Body {

src/proto/chunk.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::fmt;
2-
//use std::mem;
32

43
use bytes::Bytes;
54

0 commit comments

Comments
 (0)