From 703ac340cbf2e40ee9eed2ecc6f5f7309cbf8fde Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Thu, 12 Dec 2019 15:26:54 -0800 Subject: [PATCH] docs(body): fill in documentation of the to_bytes function --- src/body/body.rs | 5 +++-- src/body/to_bytes.rs | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/body/body.rs b/src/body/body.rs index 9df96709..f57dd0f6 100644 --- a/src/body/body.rs +++ b/src/body/body.rs @@ -16,9 +16,10 @@ use crate::upgrade::OnUpgrade; type BodySender = mpsc::Sender>; -/// A stream of `Bytes`s, used when receiving bodies. +/// A stream of `Bytes`, used when receiving bodies. /// -/// A good default `Payload` to use in many applications. +/// A good default [`HttpBody`](crates::body::HttpBody) to use in many +/// applications. #[must_use = "streams do nothing unless polled"] pub struct Body { kind: Kind, diff --git a/src/body/to_bytes.rs b/src/body/to_bytes.rs index e631580f..6a8778d3 100644 --- a/src/body/to_bytes.rs +++ b/src/body/to_bytes.rs @@ -2,7 +2,11 @@ use bytes::{Buf, BufMut, Bytes}; use super::HttpBody; -/// dox +/// Concatenate the buffers from a body into a single `Bytes` asynchronously. +/// +/// This may require copying the data into a single buffer. If you don't need +/// a contiguous buffer, prefer the [`aggregate`](crate::body::aggregate) +/// function. pub async fn to_bytes(body: T) -> Result where T: HttpBody,