remove unstable language and feature
This commit is contained in:
17
Cargo.toml
17
Cargo.toml
@@ -38,21 +38,4 @@ error-chain = "0.10"
|
|||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
unstable = []
|
|
||||||
|
|
||||||
|
|
||||||
[[example]]
|
|
||||||
name = "simple"
|
|
||||||
path = "examples/simple.rs"
|
|
||||||
|
|
||||||
[[example]]
|
|
||||||
name = "form"
|
|
||||||
path = "examples/form.rs"
|
|
||||||
|
|
||||||
[[example]]
|
|
||||||
name = "async"
|
|
||||||
path = "examples/async.rs"
|
|
||||||
required-features = ["unstable"]
|
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
|
||||||
features = ["unstable"]
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ extern crate tokio;
|
|||||||
use std::mem;
|
use std::mem;
|
||||||
use std::io::{self, Cursor};
|
use std::io::{self, Cursor};
|
||||||
use futures::{Future, Stream};
|
use futures::{Future, Stream};
|
||||||
use reqwest::unstable::async::{Client, Decoder};
|
use reqwest::async::{Client, Decoder};
|
||||||
|
|
||||||
|
|
||||||
fn fetch() -> impl Future<Item=(), Error=()> {
|
fn fetch() -> impl Future<Item=(), Error=()> {
|
||||||
|
|||||||
@@ -141,15 +141,6 @@ pub fn wrap(body: ::hyper::Body) -> Body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn take(body: &mut Body) -> Body {
|
|
||||||
use std::mem;
|
|
||||||
let inner = mem::replace(&mut body.inner, Inner::Hyper(::hyper::Body::empty()));
|
|
||||||
Body {
|
|
||||||
inner: inner,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn empty() -> Body {
|
pub fn empty() -> Body {
|
||||||
Body {
|
Body {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ use super::response::{self, Response};
|
|||||||
use connect::Connector;
|
use connect::Connector;
|
||||||
use into_url::to_uri;
|
use into_url::to_uri;
|
||||||
use redirect::{self, RedirectPolicy, check_redirect, remove_sensitive_headers};
|
use redirect::{self, RedirectPolicy, check_redirect, remove_sensitive_headers};
|
||||||
use {Certificate, Identity, IntoUrl, Method, proxy, Proxy, StatusCode, Url};
|
use {Certificate, Identity, IntoUrl, Method, Proxy, StatusCode, Url};
|
||||||
|
|
||||||
static DEFAULT_USER_AGENT: &'static str =
|
static DEFAULT_USER_AGENT: &'static str =
|
||||||
concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"));
|
concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"));
|
||||||
@@ -103,8 +103,8 @@ impl ClientBuilder {
|
|||||||
|
|
||||||
let proxies = Arc::new(config.proxies);
|
let proxies = Arc::new(config.proxies);
|
||||||
|
|
||||||
let mut connector = Connector::new(config.dns_threads, tls, proxies.clone());
|
let connector = Connector::new(config.dns_threads, tls, proxies.clone());
|
||||||
|
|
||||||
let hyper_client = ::hyper::Client::builder()
|
let hyper_client = ::hyper::Client::builder()
|
||||||
.build(connector);
|
.build(connector);
|
||||||
|
|
||||||
@@ -113,7 +113,6 @@ impl ClientBuilder {
|
|||||||
gzip: config.gzip,
|
gzip: config.gzip,
|
||||||
hyper: hyper_client,
|
hyper: hyper_client,
|
||||||
headers: config.headers,
|
headers: config.headers,
|
||||||
proxies: proxies,
|
|
||||||
redirect_policy: config.redirect_policy,
|
redirect_policy: config.redirect_policy,
|
||||||
referer: config.referer,
|
referer: config.referer,
|
||||||
}),
|
}),
|
||||||
@@ -449,7 +448,6 @@ struct ClientRef {
|
|||||||
gzip: bool,
|
gzip: bool,
|
||||||
headers: HeaderMap,
|
headers: HeaderMap,
|
||||||
hyper: HyperClient,
|
hyper: HyperClient,
|
||||||
proxies: Arc<Vec<Proxy>>,
|
|
||||||
redirect_policy: RedirectPolicy,
|
redirect_policy: RedirectPolicy,
|
||||||
referer: bool,
|
referer: bool,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,19 +25,12 @@ use std::fmt;
|
|||||||
use std::mem;
|
use std::mem;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::io::{self, Read};
|
use std::io::{self, Read};
|
||||||
use std::marker::PhantomData;
|
|
||||||
|
|
||||||
use bytes::{BufMut, BytesMut};
|
use bytes::{BufMut, BytesMut};
|
||||||
use libflate::non_blocking::gzip;
|
use libflate::non_blocking::gzip;
|
||||||
use tokio_io::AsyncRead;
|
|
||||||
use tokio_io::io as async_io;
|
|
||||||
use futures::{Async, Future, Poll, Stream};
|
use futures::{Async, Future, Poll, Stream};
|
||||||
use futures::stream::Concat2;
|
use hyper::{HeaderMap};
|
||||||
use hyper::{HeaderMap, StatusCode};
|
|
||||||
use hyper::header::{CONTENT_ENCODING, CONTENT_LENGTH, TRANSFER_ENCODING, HeaderValue};
|
use hyper::header::{CONTENT_ENCODING, CONTENT_LENGTH, TRANSFER_ENCODING, HeaderValue};
|
||||||
use serde::de::DeserializeOwned;
|
|
||||||
use serde_json;
|
|
||||||
use url::Url;
|
|
||||||
|
|
||||||
use super::{body, Body, Chunk};
|
use super::{body, Body, Chunk};
|
||||||
use error;
|
use error;
|
||||||
@@ -106,7 +99,7 @@ impl Decoder {
|
|||||||
///
|
///
|
||||||
/// This decoder will buffer and decompress chunks that are gzipped.
|
/// This decoder will buffer and decompress chunks that are gzipped.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn gzip(mut body: Body) -> Decoder {
|
fn gzip(body: Body) -> Decoder {
|
||||||
Decoder {
|
Decoder {
|
||||||
inner: Inner::Pending(Pending::Gzip(ReadableChunks::new(body)))
|
inner: Inner::Pending(Pending::Gzip(ReadableChunks::new(body)))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
#![cfg_attr(not(features = "unstable"), allow(unused))]
|
|
||||||
|
|
||||||
pub use self::body::{Body, Chunk};
|
pub use self::body::{Body, Chunk};
|
||||||
pub use self::decoder::{Decoder, ReadableChunks};
|
pub use self::decoder::{Decoder, ReadableChunks};
|
||||||
pub use self::client::{Client, ClientBuilder};
|
pub use self::client::{Client, ClientBuilder};
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use base64::{encode};
|
use base64::{encode};
|
||||||
use mime::{self};
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use serde_json;
|
use serde_json;
|
||||||
use serde_urlencoded;
|
use serde_urlencoded;
|
||||||
|
|
||||||
use super::body::{self, Body};
|
use super::body::{Body};
|
||||||
use super::client::{Client, Pending, pending_err};
|
use super::client::{Client, Pending, pending_err};
|
||||||
use header::{CONTENT_TYPE, HeaderMap, HeaderName, HeaderValue};
|
use header::{CONTENT_TYPE, HeaderMap, HeaderName, HeaderValue};
|
||||||
use http::HttpTryFrom;
|
use http::HttpTryFrom;
|
||||||
@@ -124,7 +123,7 @@ impl RequestBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Enable HTTP basic authentication.
|
/// Enable HTTP basic authentication.
|
||||||
pub fn basic_auth<U, P>(mut self, username: U, password: Option<P>) -> RequestBuilder
|
pub fn basic_auth<U, P>(self, username: U, password: Option<P>) -> RequestBuilder
|
||||||
where
|
where
|
||||||
U: fmt::Display,
|
U: fmt::Display,
|
||||||
P: fmt::Display,
|
P: fmt::Display,
|
||||||
|
|||||||
@@ -1,21 +1,15 @@
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::io::{self, Read};
|
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
use libflate::non_blocking::gzip;
|
|
||||||
use tokio_io::AsyncRead;
|
|
||||||
use tokio_io::io as async_io;
|
|
||||||
use futures::{Async, Future, Poll, Stream};
|
use futures::{Async, Future, Poll, Stream};
|
||||||
use futures::stream::Concat2;
|
use futures::stream::Concat2;
|
||||||
use hyper::{StatusCode, Version};
|
use hyper::{HeaderMap, StatusCode, Version};
|
||||||
use serde::de::DeserializeOwned;
|
use serde::de::DeserializeOwned;
|
||||||
use serde_json;
|
use serde_json;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use hyper::header::{HeaderMap, CONTENT_ENCODING, CONTENT_LENGTH, TRANSFER_ENCODING};
|
use super::{decoder, body, Decoder};
|
||||||
use super::{decoder, body, Body, Chunk, Decoder};
|
|
||||||
use error;
|
|
||||||
|
|
||||||
|
|
||||||
/// A Response to a submitted `Request`.
|
/// A Response to a submitted `Request`.
|
||||||
@@ -95,9 +89,7 @@ impl Response {
|
|||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # #[cfg(feature="unstable")]
|
/// # use reqwest::async::Response;
|
||||||
/// # use reqwest::unstable::async::Response;
|
|
||||||
/// # #[cfg(feature="unstable")]
|
|
||||||
/// fn on_response(res: Response) {
|
/// fn on_response(res: Response) {
|
||||||
/// match res.error_for_status() {
|
/// match res.error_for_status() {
|
||||||
/// Ok(_res) => (),
|
/// Ok(_res) => (),
|
||||||
|
|||||||
37
src/lib.rs
37
src/lib.rs
@@ -187,30 +187,21 @@ mod wait;
|
|||||||
|
|
||||||
pub mod multipart;
|
pub mod multipart;
|
||||||
|
|
||||||
/// A set of unstable functionality.
|
/// An 'async' implementation of the reqwest `Client`.
|
||||||
///
|
///
|
||||||
/// This module is only available when the `unstable` [feature][] is enabled.
|
/// Relies on the `futures` crate, which is unstable, hence this module
|
||||||
/// There is no backwards compatibility guarantee for any of the types within.
|
/// is **unstable**.
|
||||||
///
|
pub mod async {
|
||||||
/// [feature]: http://doc.crates.io/specifying-dependencies.html#choosing-features
|
pub use ::async_impl::{
|
||||||
#[cfg(feature = "unstable")]
|
Body,
|
||||||
pub mod unstable {
|
Chunk,
|
||||||
/// An 'async' implementation of the reqwest `Client`.
|
Decoder,
|
||||||
///
|
Client,
|
||||||
/// Relies on the `futures` crate, which is unstable, hence this module
|
ClientBuilder,
|
||||||
/// is **unstable**.
|
Request,
|
||||||
pub mod async {
|
RequestBuilder,
|
||||||
pub use ::async_impl::{
|
Response,
|
||||||
Body,
|
};
|
||||||
Chunk,
|
|
||||||
Decoder,
|
|
||||||
Client,
|
|
||||||
ClientBuilder,
|
|
||||||
Request,
|
|
||||||
RequestBuilder,
|
|
||||||
Response,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Shortcut method to quickly make a `GET` request.
|
/// Shortcut method to quickly make a `GET` request.
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
#![cfg(feature="unstable")]
|
|
||||||
|
|
||||||
extern crate futures;
|
extern crate futures;
|
||||||
extern crate libflate;
|
extern crate libflate;
|
||||||
extern crate reqwest;
|
extern crate reqwest;
|
||||||
@@ -8,7 +6,7 @@ extern crate tokio;
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod support;
|
mod support;
|
||||||
|
|
||||||
use reqwest::unstable::async::Client;
|
use reqwest::async::Client;
|
||||||
use futures::{Future, Stream};
|
use futures::{Future, Stream};
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|||||||
Reference in New Issue
Block a user