Normalize naming scheme (#62)
This commit is contained in:
parent
7caef48bfe
commit
7b6cd0355d
|
@ -96,7 +96,7 @@ use std::sync::Arc;
|
||||||
/// use tokio_timer::Timer;
|
/// use tokio_timer::Timer;
|
||||||
///
|
///
|
||||||
/// pub struct Timeout<T> {
|
/// pub struct Timeout<T> {
|
||||||
/// upstream: T,
|
/// inner: T,
|
||||||
/// delay: Duration,
|
/// delay: Duration,
|
||||||
/// timer: Timer,
|
/// timer: Timer,
|
||||||
/// }
|
/// }
|
||||||
|
@ -104,9 +104,9 @@ use std::sync::Arc;
|
||||||
/// pub struct Expired;
|
/// pub struct Expired;
|
||||||
///
|
///
|
||||||
/// impl<T> Timeout<T> {
|
/// impl<T> Timeout<T> {
|
||||||
/// pub fn new(upstream: T, delay: Duration) -> Timeout<T> {
|
/// pub fn new(inner: T, delay: Duration) -> Timeout<T> {
|
||||||
/// Timeout {
|
/// Timeout {
|
||||||
/// upstream: upstream,
|
/// inner: inner,
|
||||||
/// delay: delay,
|
/// delay: delay,
|
||||||
/// timer: Timer::default(),
|
/// timer: Timer::default(),
|
||||||
/// }
|
/// }
|
||||||
|
@ -130,7 +130,7 @@ use std::sync::Arc;
|
||||||
/// let timeout = self.timer.sleep(self.delay)
|
/// let timeout = self.timer.sleep(self.delay)
|
||||||
/// .and_then(|_| Err(Self::Error::from(Expired)));
|
/// .and_then(|_| Err(Self::Error::from(Expired)));
|
||||||
///
|
///
|
||||||
/// self.upstream.call(req)
|
/// self.inner.call(req)
|
||||||
/// .select(timeout)
|
/// .select(timeout)
|
||||||
/// .map(|(v, _)| v)
|
/// .map(|(v, _)| v)
|
||||||
/// .map_err(|(e, _)| e)
|
/// .map_err(|(e, _)| e)
|
||||||
|
|
|
@ -17,7 +17,7 @@ use std::time::Duration;
|
||||||
/// Applies a timeout to requests.
|
/// Applies a timeout to requests.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Timeout<T> {
|
pub struct Timeout<T> {
|
||||||
upstream: T,
|
inner: T,
|
||||||
timer: Timer,
|
timer: Timer,
|
||||||
timeout: Duration,
|
timeout: Duration,
|
||||||
}
|
}
|
||||||
|
@ -42,9 +42,9 @@ pub struct ResponseFuture<T> {
|
||||||
// ===== impl Timeout =====
|
// ===== impl Timeout =====
|
||||||
|
|
||||||
impl<T> Timeout<T> {
|
impl<T> Timeout<T> {
|
||||||
pub fn new(upstream: T, timer: Timer, timeout: Duration) -> Self {
|
pub fn new(inner: T, timer: Timer, timeout: Duration) -> Self {
|
||||||
Timeout {
|
Timeout {
|
||||||
upstream,
|
inner,
|
||||||
timer,
|
timer,
|
||||||
timeout,
|
timeout,
|
||||||
}
|
}
|
||||||
|
@ -60,13 +60,13 @@ where S: Service,
|
||||||
type Future = ResponseFuture<S::Future>;
|
type Future = ResponseFuture<S::Future>;
|
||||||
|
|
||||||
fn poll_ready(&mut self) -> Poll<(), Self::Error> {
|
fn poll_ready(&mut self) -> Poll<(), Self::Error> {
|
||||||
self.upstream.poll_ready()
|
self.inner.poll_ready()
|
||||||
.map_err(Error::Inner)
|
.map_err(Error::Inner)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn call(&mut self, request: Self::Request) -> Self::Future {
|
fn call(&mut self, request: Self::Request) -> Self::Future {
|
||||||
ResponseFuture {
|
ResponseFuture {
|
||||||
response: self.upstream.call(request),
|
response: self.inner.call(request),
|
||||||
sleep: self.timer.sleep(self.timeout),
|
sleep: self.timer.sleep(self.timeout),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue