mirror of
https://github.com/tower-rs/tower.git
synced 2025-09-30 06:21:17 +00:00
28 lines
534 B
Rust
28 lines
534 B
Rust
use super::error::Error;
|
|
use futures::{Future, Poll};
|
|
|
|
/// Future for the `RateLimit` service.
|
|
#[derive(Debug)]
|
|
pub struct ResponseFuture<T> {
|
|
inner: T,
|
|
}
|
|
|
|
impl<T> ResponseFuture<T> {
|
|
pub(crate) fn new(inner: T) -> ResponseFuture<T> {
|
|
ResponseFuture { inner }
|
|
}
|
|
}
|
|
|
|
impl<T> Future for ResponseFuture<T>
|
|
where
|
|
T: Future,
|
|
Error: From<T::Error>,
|
|
{
|
|
type Item = T::Item;
|
|
type Error = Error;
|
|
|
|
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
|
|
self.inner.poll().map_err(Into::into)
|
|
}
|
|
}
|