Skip to content

Commit 703ac34

Browse files
committed
docs(body): fill in documentation of the to_bytes function
1 parent cb71d2c commit 703ac34

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/body/body.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ use crate::upgrade::OnUpgrade;
1616

1717
type BodySender = mpsc::Sender<Result<Bytes, crate::Error>>;
1818

19-
/// A stream of `Bytes`s, used when receiving bodies.
19+
/// A stream of `Bytes`, used when receiving bodies.
2020
///
21-
/// A good default `Payload` to use in many applications.
21+
/// A good default [`HttpBody`](crates::body::HttpBody) to use in many
22+
/// applications.
2223
#[must_use = "streams do nothing unless polled"]
2324
pub struct Body {
2425
kind: Kind,

src/body/to_bytes.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ use bytes::{Buf, BufMut, Bytes};
22

33
use super::HttpBody;
44

5-
/// dox
5+
/// Concatenate the buffers from a body into a single `Bytes` asynchronously.
6+
///
7+
/// This may require copying the data into a single buffer. If you don't need
8+
/// a contiguous buffer, prefer the [`aggregate`](crate::body::aggregate)
9+
/// function.
610
pub async fn to_bytes<T>(body: T) -> Result<Bytes, T::Error>
711
where
812
T: HttpBody,

0 commit comments

Comments
 (0)