Skip to content

Commit

Permalink
pub(crate)ify the async::client module
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Sep 11, 2018
1 parent 1ded95c commit 55fcedc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/async_impl/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ enum PendingInner {
Error(Option<::Error>),
}

pub struct PendingRequest {
struct PendingRequest {
method: Method,
url: Url,
headers: HeaderMap,
Expand All @@ -420,6 +420,13 @@ pub struct PendingRequest {
in_flight: ResponseFuture,
}

impl Pending {
pub(super) fn new_err(err: ::Error) -> Pending {
Pending {
inner: PendingInner::Error(Some(err)),
}
}
}

impl Future for Pending {
type Item = Response;
Expand Down Expand Up @@ -551,10 +558,3 @@ fn make_referer(next: &Url, previous: &Url) -> Option<HeaderValue> {
referer.as_str().parse().ok()
}

// pub(crate)

pub fn pending_err(err: ::Error) -> Pending {
Pending {
inner: PendingInner::Error(Some(err)),
}
}
4 changes: 2 additions & 2 deletions src/async_impl/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use serde_json;
use serde_urlencoded;

use super::body::{Body};
use super::client::{Client, Pending, pending_err};
use super::client::{Client, Pending};
use header::{CONTENT_TYPE, HeaderMap, HeaderName, HeaderValue};
use http::HttpTryFrom;
use {Method, Url};
Expand Down Expand Up @@ -277,7 +277,7 @@ impl RequestBuilder {
pub fn send(self) -> Pending {
match self.request {
Ok(req) => self.client.execute(req),
Err(err) => pending_err(err),
Err(err) => Pending::new_err(err),
}
}
}
Expand Down

0 comments on commit 55fcedc

Please sign in to comment.