Skip to content

Commit

Permalink
util: Update docs (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
tottoto committed Feb 14, 2023
1 parent 1ab0df8 commit 619ba28
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 9 deletions.
2 changes: 2 additions & 0 deletions http-body-util/src/collected.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use crate::util::BufList;

/// A collected body produced by [`BodyExt::collect`] which collects all the DATA frames
/// and trailers.
///
/// [`BodyExt::collect`]: crate::BodyExt::collect
#[derive(Debug)]
pub struct Collected<B> {
bufs: BufList<B>,
Expand Down
4 changes: 3 additions & 1 deletion http-body-util/src/combinators/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ use http_body::Body;
use pin_project_lite::pin_project;

pin_project! {
/// Future that resolves into a `Collected`.
/// Future that resolves into a [`Collected`].
///
/// [`Collected`]: crate::Collected
pub struct Collect<T>
where
T: Body,
Expand Down
2 changes: 1 addition & 1 deletion http-body-util/src/combinators/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use core::task;

#[must_use = "futures don't do anything unless polled"]
#[derive(Debug)]
/// Future that resolves to the next frame from a `Body`.
/// Future that resolves to the next frame from a [`Body`].
pub struct Frame<'a, T: ?Sized>(pub(crate) &'a mut T);

impl<'a, T: Body + Unpin + ?Sized> Future for Frame<'a, T> {
Expand Down
2 changes: 1 addition & 1 deletion http-body-util/src/combinators/map_err.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::{
pin_project! {
/// Body returned by the [`map_err`] combinator.
///
/// [`map_err`]: crate::util::BodyExt::map_err
/// [`map_err`]: crate::BodyExt::map_err
#[derive(Clone, Copy)]
pub struct MapErr<B, F> {
#[pin]
Expand Down
4 changes: 2 additions & 2 deletions http-body-util/src/combinators/map_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use std::{
};

pin_project! {
/// Body returned by the [`map_data`] combinator.
/// Body returned by the [`map_frame`] combinator.
///
/// [`map_data`]: crate::util::BodyExt::map_data
/// [`map_frame`]: crate::BodyExt::map_frame
#[derive(Clone, Copy)]
pub struct MapFrame<B, F> {
#[pin]
Expand Down
7 changes: 5 additions & 2 deletions http-body-util/src/either.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ use bytes::Buf;
use http_body::{Body, Frame, SizeHint};
use proj::EitherProj;

/// Sum type with two cases: `Left` and `Right`, used if a body can be one of
/// Sum type with two cases: [`Left`] and [`Right`], used if a body can be one of
/// two distinct types.
///
/// [`Left`]: Either::Left
/// [`Right`]: Either::Right
#[derive(Debug, Clone, Copy)]
pub enum Either<L, R> {
/// A value of type `L`
Expand Down Expand Up @@ -99,7 +102,7 @@ pub(crate) mod proj {
//! Right {#[pin] right: R}
//! }
//! }
//! ```
//! ```
//!
//! [pin-project-lite]: https://docs.rs/pin-project-lite/latest/pin_project_lite/
use std::marker::PhantomData;
Expand Down
4 changes: 3 additions & 1 deletion http-body-util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ pub use self::stream::StreamBody;

/// An extension trait for [`http_body::Body`] adding various combinators and adapters
pub trait BodyExt: http_body::Body {
/// Returns a future that resolves to the next `Frame`, if any.
/// Returns a future that resolves to the next [`Frame`], if any.
///
/// [`Frame`]: combinators::Frame
fn frame(&mut self) -> combinators::Frame<'_, Self>
where
Self: Unpin,
Expand Down
2 changes: 1 addition & 1 deletion http-body-util/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{
};

pin_project! {
/// A body created from a `Stream`.
/// A body created from a [`Stream`].
#[derive(Clone, Copy, Debug)]
pub struct StreamBody<S> {
#[pin]
Expand Down

0 comments on commit 619ba28

Please sign in to comment.