pub async fn trailers(&mut self) -> Result<Option<MetadataMap>, Status> {
        // Shortcut to see if we already pulled the trailers in the stream step
        // we need to do that so that the stream can error on trailing grpc-status
        if let Some(trailers) = self.inner.trailers.take() {
            return Ok(Some(MetadataMap::from_headers(trailers)));
        }

        // To fetch the trailers we must clear the body and drop it.
        while self.message().await?.is_some() {}

        // Since we call poll_trailers internally on poll_next we need to
        // check if it got cached again.
        if let Some(trailers) = self.inner.trailers.take() {
            return Ok(Some(MetadataMap::from_headers(trailers)));
        }

        // We've polled through all the frames, and still no trailers, return None
        Ok(None)
    }
Fetch the trailing metadata.

This will drain the stream of all its messages to receive the trailing
metadata. If [`Streaming::message`] returns `None` then this function
will not need to poll for trailers since the body was totally consumed.

```rust
# use tonic::{Streaming, Status};
# async fn trailers_ex<T>(mut request: Streaming<T>) -> Result<(), Status> {
if let Some(metadata) = request.trailers().await? {
println!("{:?}", metadata);
}
# Ok(())
# }
```
tonic/src/codec/decode.rs