tower_grpc/client/
server_streaming.rs

1use super::streaming;
2use crate::codec::Streaming;
3use crate::error::Error;
4use crate::Body;
5
6use futures::{Future, Poll};
7use http::Response;
8use prost::Message;
9
10#[derive(Debug)]
11pub struct ResponseFuture<T, U> {
12    inner: streaming::ResponseFuture<T, U>,
13}
14
15impl<T, U> ResponseFuture<T, U> {
16    /// Create a new client-streaming response future.
17    pub(crate) fn new(inner: streaming::ResponseFuture<T, U>) -> Self {
18        ResponseFuture { inner }
19    }
20}
21
22impl<T, U, B> Future for ResponseFuture<T, U>
23where
24    T: Message + Default,
25    U: Future<Item = Response<B>>,
26    U::Error: Into<Error>,
27    B: Body,
28{
29    type Item = crate::Response<Streaming<T, B>>;
30    type Error = crate::Status;
31
32    fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
33        self.inner.poll()
34    }
35}