docs: document Streaming::message() return values (#1006)

This commit is contained in:
Matthias Vogelgesang
2022-05-23 21:30:06 +02:00
committed by GitHub
parent ec9ee61925
commit 91b73f9fc3
+14
View File
@@ -136,6 +136,20 @@ impl<T> Streaming<T> {
impl<T> Streaming<T> {
/// Fetch the next message from this stream.
///
/// # Return value
///
/// - `Result::Err(val)` means a gRPC error was sent by the sender instead
/// of a valid response message. Refer to [`Status::code`] and
/// [`Status::message`] to examine possible error causes.
///
/// - `Result::Ok(None)` means the stream was closed by the sender and no
/// more messages will be delivered. Further attempts to call
/// [`Streaming::message`] will result in the same return value.
///
/// - `Result::Ok(Some(val))` means the sender streamed a valid response
/// message `val`.
///
/// ```rust
/// # use tonic::{Streaming, Status, codec::Decoder};
/// # use std::fmt::Debug;