Skip to content

Commit

Permalink
fix(docs): Body
Browse files Browse the repository at this point in the history
  • Loading branch information
fundon committed Dec 13, 2023
1 parent 7448064 commit b92d887
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions viz-core/src/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,25 @@ use hyper::body::{Body, Frame, Incoming, SizeHint};

use crate::{Bytes, Error, Result};

/// Incoming Body from request.
/// The incoming body from HTTP [`Request`].
///
/// [`Request`]: crate::Request
#[derive(Debug)]
pub enum IncomingBody {
/// A empty body.
/// An empty body.
Empty,
/// A incoming body.
/// An incoming body.
Incoming(Option<Incoming>),
}

impl IncomingBody {
/// Creates new Incoming Body
/// Creates new incoming body.
#[must_use]
pub fn new(inner: Option<Incoming>) -> Self {
Self::Incoming(inner)
}

/// Incoming body has been used
/// The incoming body has been used.
#[must_use]
pub fn used() -> Self {
Self::Incoming(None)
Expand Down Expand Up @@ -107,10 +109,12 @@ impl Stream for IncomingBody {
}
}

/// Outgoing Body to response.
/// The outgoing body to HTTP [`Response`].
///
/// [`Response`]: crate::Response
#[derive(Debug)]
pub enum OutgoingBody<D = Bytes> {
/// A empty body.
/// An empty body.
Empty,
/// A body that consists of a single chunk.
Full(Full<D>),
Expand Down

0 comments on commit b92d887

Please sign in to comment.