Skip to content

Commit

Permalink
chore(server): setup ServerProto pieces to be deprecated
Browse files Browse the repository at this point in the history
- Adds a `server-proto` feature that is added to default features.
- If `server-proto` feature is not enabled, pieces that will eventually
  be deprecated and optional will be tagged deprecated, but with a note
  about the missing `server-proto` feature.
  • Loading branch information
seanmonstar committed Nov 9, 2017
1 parent 1bb3258 commit b60d4cd
Show file tree
Hide file tree
Showing 5 changed files with 323 additions and 258 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ pretty_env_logger = "0.1"
spmc = "0.2"

[features]
default = []
default = ["server-proto"]
nightly = []
raw_status = []
compat = [ "http" ]
server-proto = []
20 changes: 18 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ extern crate unicase;
#[cfg(all(test, feature = "nightly"))]
extern crate test;


mod common;
pub use uri::Uri;
pub use client::Client;
pub use error::{Result, Error};
Expand All @@ -55,6 +53,24 @@ pub use version::HttpVersion;
#[cfg(feature = "raw_status")]
pub use proto::RawStatus;

macro_rules! feat_server_proto {
($($i:item)*) => ($(
#[cfg_attr(
not(feature = "server-proto"),
deprecated(
since="0.11.7",
note="server-proto was recently added to default features, but you have disabled default features. A future version will remove these types if the server-proto feature is not enabled."
)
)]
#[cfg_attr(
not(feature = "server-proto"),
allow(deprecated)
)]
$i
)*)
}

mod common;
#[cfg(test)]
mod mock;
pub mod client;
Expand Down
4 changes: 4 additions & 0 deletions src/proto/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,17 @@ impl Stream for Body {
}
}

// deprecate soon, but can't really deprecate trait impls
#[doc(hidden)]
impl From<Body> for tokio_proto::streaming::Body<Chunk, ::Error> {
#[inline]
fn from(b: Body) -> tokio_proto::streaming::Body<Chunk, ::Error> {
b.0
}
}

// deprecate soon, but can't really deprecate trait impls
#[doc(hidden)]
impl From<tokio_proto::streaming::Body<Chunk, ::Error>> for Body {
#[inline]
fn from(tokio_body: tokio_proto::streaming::Body<Chunk, ::Error>) -> Body {
Expand Down
Loading

0 comments on commit b60d4cd

Please sign in to comment.