Skip to main content

RecvStream

Struct RecvStream 

Source
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>

Source

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.

Source

pub fn trailers(&self) -> &HeaderMap

The trailers of the peer, available once the stream has ended.

Source

pub fn status(&self) -> Option<GrpcStatus>

The status the stream ended with, None until it has ended.

Source§

impl<T: Message> RecvStream<T>

Source

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.

Source

pub async fn recv(&mut self) -> Option<Result<T, StreamError>>

Receives the next message, None once the peer has ended the stream.

Trait Implementations§

Source§

impl<T> Debug for RecvStream<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Drop for RecvStream<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<T: Message> Stream for RecvStream<T>

Source§

type Item = Result<T, StreamError>

Values yielded by the stream.
Source§

fn poll_next( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Option<Self::Item>>

Attempt to pull out the next value of this stream, registering the current task for wakeup if the value is not yet available, and returning None if the stream is exhausted. Read more
Source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the stream. Read more

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for RecvStream<T>

§

impl<T> !Send for RecvStream<T>

§

impl<T> !Sync for RecvStream<T>

§

impl<T> !UnwindSafe for RecvStream<T>

§

impl<T> Forget for RecvStream<T>

§

impl<T> Freeze for RecvStream<T>
where PhantomData<fn() -> T>: Freeze,

§

impl<T> Move for RecvStream<T>

§

impl<T> Unpin for RecvStream<T>
where PhantomData<fn() -> T>: Unpin,

§

impl<T> UnsafeUnpin for RecvStream<T>
where PhantomData<fn() -> T>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRequest<T> for T

Source§

fn from(input: Request<T>) -> T

Build the argument from the decoded request.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MethodResult<T> for T

Source§

fn into_response(self) -> Result<Response<T>, ServerError>

Turn into the reply, or the error the call ends with. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T, E> TryStream for S
where S: Stream<Item = Result<T, E>> + ?Sized,

Source§

type Ok = T

The type of successful values yielded by this future
Source§

type Error = E

The type of failures yielded by this future
Source§

fn try_poll_next( self: Pin<&mut S>, cx: &mut Context<'_>, ) -> Poll<Option<Result<<S as TryStream>::Ok, <S as TryStream>::Error>>>

Poll this TryStream as if it were a Stream. Read more
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V