pub struct RecvStream<T> { /* private fields */ }Expand description
A stream of messages from the peer.
On the client, the response messages of a server-streaming or a bidi call. On the server, the request messages of a client-streaming or a bidi call.
Messages are read with recv() or as a Stream. The
stream ends with None once the peer ends it, or with an error. The
messages received before an error are read first.
A decoding error discards the remaining buffered data and releases its flow-control capacity.
The client reports the status of the call as StreamError::Client.
Dropping the stream on the client before its end cancels the call.
Implementations§
Source§impl<T> RecvStream<T>
impl<T> RecvStream<T>
Sourcepub fn headers(&self) -> &HeaderMap
pub fn headers(&self) -> &HeaderMap
The headers of the peer.
On the client, the response headers, available once the first message or the end of the stream is received. On the server, the request headers.
Sourcepub fn trailers(&self) -> &HeaderMap
pub fn trailers(&self) -> &HeaderMap
The trailers of the peer, available once the stream has ended.
Sourcepub fn status(&self) -> Option<GrpcStatus>
pub fn status(&self) -> Option<GrpcStatus>
The status the stream ended with, None until it has ended.
Source§impl<T: Message> RecvStream<T>
impl<T: Message> RecvStream<T>
Sourcepub fn poll_recv(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Option<Result<T, StreamError>>>
pub fn poll_recv( &mut self, cx: &mut Context<'_>, ) -> Poll<Option<Result<T, StreamError>>>
Polls for the next message.
Returns None once the peer has ended the stream. After an error
the stream returns None.
Sourcepub async fn recv(&mut self) -> Option<Result<T, StreamError>>
pub async fn recv(&mut self) -> Option<Result<T, StreamError>>
Receives the next message, None once the peer has ended the stream.