Skip to content

Commit

Permalink
Re-export hyper::Uri as shiplift::Uri (#209)
Browse files Browse the repository at this point in the history
This patch removes the explicit dependency on the http crate and
instead accesses the re-exported version of hyper. This should make
the update process slightly easier because those versions would
need to be kept in sync manually.

We also re-export hyper::Uri as shiplift::Uri because it is part
of the public API of shiplift::Docker. This allows users to access
the Uri type without having to seperately depend on http or hyper.
  • Loading branch information
thomaseizinger authored and softprops committed Dec 27, 2019
1 parent 1718105 commit a368a93
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ bytes = "0.4"
chrono = { version = "0.4", optional = true, features = ["serde"] }
flate2 = "1.0"
futures = "0.1"
http = "0.1"
hyper = "0.12"
hyper-openssl = { version = "0.7", optional = true }
hyperlocal = { version = "0.6", optional = true }
Expand Down
7 changes: 3 additions & 4 deletions src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Representations of various client errors
use http;
use hyper::{self, StatusCode};
use serde_json::Error as SerdeError;
use std::{error::Error as StdError, fmt, io::Error as IoError, string::FromUtf8Error};
Expand All @@ -9,7 +8,7 @@ use std::{error::Error as StdError, fmt, io::Error as IoError, string::FromUtf8E
pub enum Error {
SerdeJsonError(SerdeError),
Hyper(hyper::Error),
Http(http::Error),
Http(hyper::http::Error),
IO(IoError),
Encoding(FromUtf8Error),
InvalidResponse(String),
Expand All @@ -29,8 +28,8 @@ impl From<hyper::Error> for Error {
}
}

impl From<http::Error> for Error {
fn from(error: http::Error) -> Error {
impl From<hyper::http::Error> for Error {
fn from(error: hyper::http::Error) -> Error {
Error::Http(error)
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ use crate::{
tty::TtyDecoder,
};
use futures::{future::Either, Future, IntoFuture, Stream};
use hyper::{client::HttpConnector, Body, Client, Method, Uri};
pub use hyper::Uri;
use hyper::{client::HttpConnector, Body, Client, Method};
#[cfg(feature = "tls")]
use hyper_openssl::HttpsConnector;
#[cfg(feature = "unix-socket")]
Expand Down
2 changes: 1 addition & 1 deletion src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl Transport {
endpoint: &str,
body: Option<(B, Mime)>,
headers: Option<H>,
f: impl FnOnce(&mut ::http::request::Builder),
f: impl FnOnce(&mut ::hyper::http::request::Builder),
) -> Result<Request<Body>>
where
B: Into<Body>,
Expand Down
4 changes: 4 additions & 0 deletions tests/reexported_types.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#[test]
fn can_access_uri_from_shiplift_crate() {
let _ = shiplift::Uri::default();
}

0 comments on commit a368a93

Please sign in to comment.