refactor(lib): update to 2018 edition
This commit is contained in:
@@ -5,15 +5,15 @@ use futures::sync::{mpsc, oneshot};
|
||||
use h2::client::{Builder, Handshake, SendRequest};
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
|
||||
use headers::content_length_parse_all;
|
||||
use body::Payload;
|
||||
use ::common::{Exec, Never};
|
||||
use headers;
|
||||
use ::proto::Dispatched;
|
||||
use crate::headers::content_length_parse_all;
|
||||
use crate::body::Payload;
|
||||
use crate::common::{Exec, Never};
|
||||
use crate::headers;
|
||||
use crate::proto::Dispatched;
|
||||
use super::{PipeToSendStream, SendBuf};
|
||||
use ::{Body, Request, Response};
|
||||
use crate::{Body, Request, Response};
|
||||
|
||||
type ClientRx<B> = ::client::dispatch::Receiver<Request<B>, Response<Body>>;
|
||||
type ClientRx<B> = crate::client::dispatch::Receiver<Request<B>, Response<Body>>;
|
||||
/// An mpsc channel is used to help notify the `Connection` task when *all*
|
||||
/// other handles to it have been dropped, so that it can shutdown.
|
||||
type ConnDropRef = mpsc::Sender<Never>;
|
||||
@@ -58,13 +58,13 @@ where
|
||||
B: Payload + 'static,
|
||||
{
|
||||
type Item = Dispatched;
|
||||
type Error = ::Error;
|
||||
type Error = crate::Error;
|
||||
|
||||
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
|
||||
loop {
|
||||
let next = match self.state {
|
||||
State::Handshaking(ref mut h) => {
|
||||
let (request_tx, conn) = try_ready!(h.poll().map_err(::Error::new_h2));
|
||||
let (request_tx, conn) = try_ready!(h.poll().map_err(crate::Error::new_h2));
|
||||
// An mpsc channel is used entirely to detect when the
|
||||
// 'Client' has been dropped. This is to get around a bug
|
||||
// in h2 where dropping all SendRequests won't notify a
|
||||
@@ -111,7 +111,7 @@ where
|
||||
trace!("connection gracefully shutdown");
|
||||
Ok(Async::Ready(Dispatched::Shutdown))
|
||||
} else {
|
||||
Err(::Error::new_h2(err))
|
||||
Err(crate::Error::new_h2(err))
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -133,7 +133,7 @@ where
|
||||
Ok(ok) => ok,
|
||||
Err(err) => {
|
||||
debug!("client send request error: {}", err);
|
||||
cb.send(Err((::Error::new_h2(err), None)));
|
||||
cb.send(Err((crate::Error::new_h2(err), None)));
|
||||
continue;
|
||||
}
|
||||
};
|
||||
@@ -162,12 +162,12 @@ where
|
||||
Ok(res) => {
|
||||
let content_length = content_length_parse_all(res.headers());
|
||||
let res = res.map(|stream|
|
||||
::Body::h2(stream, content_length));
|
||||
crate::Body::h2(stream, content_length));
|
||||
Ok(res)
|
||||
},
|
||||
Err(err) => {
|
||||
debug!("client response error: {}", err);
|
||||
Err((::Error::new_h2(err), None))
|
||||
Err((crate::Error::new_h2(err), None))
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user