upgrade hyper to v0.11

This commit is contained in:
Sean McArthur
2017-06-20 21:27:59 -07:00
parent 8633060eaf
commit 665b4fe718
26 changed files with 2647 additions and 1027 deletions

34
src/into_url.rs Normal file
View File

@@ -0,0 +1,34 @@
use url::{Url, ParseError};
/// A trait to try to convert some type into a `Url`.
///
/// This trait is "sealed", such that only types within reqwest can
/// implement it. The reason is that it will eventually be deprecated
/// and removed, when `std::convert::TryFrom` is stabilized.
pub trait IntoUrl: PolyfillTryInto {}
impl<T: PolyfillTryInto> IntoUrl for T {}
// pub(crate)
pub trait PolyfillTryInto {
fn into_url(self) -> Result<Url, ParseError>;
}
impl PolyfillTryInto for Url {
fn into_url(self) -> Result<Url, ParseError> {
Ok(self)
}
}
impl<'a> PolyfillTryInto for &'a str {
fn into_url(self) -> Result<Url, ParseError> {
Url::parse(self)
}
}
impl<'a> PolyfillTryInto for &'a String {
fn into_url(self) -> Result<Url, ParseError> {
Url::parse(self)
}
}