pub(crate) where we can

This commit is contained in:
Martin Algesten
2018-12-20 11:08:20 +01:00
parent 1519dcb0b1
commit 07fd4d2cd5
7 changed files with 23 additions and 21 deletions

View File

@@ -17,7 +17,7 @@ use serde_json;
/// The different kinds of bodies to send.
///
/// *Internal API*
pub enum Payload {
pub(crate) enum Payload {
Empty,
Text(String, String),
#[cfg(feature = "json")]
@@ -48,7 +48,7 @@ impl Default for Payload {
/// Payloads are turned into this type where we can hold both a size and the reader.
///
/// *Internal API*
pub struct SizedReader {
pub(crate) struct SizedReader {
pub size: Option<usize>,
pub reader: Box<dyn Read + 'static>,
}
@@ -96,7 +96,11 @@ impl Payload {
}
/// Helper to send a body, either as chunked or not.
pub fn send_body(mut body: SizedReader, do_chunk: bool, stream: &mut Stream) -> IoResult<()> {
pub(crate) fn send_body(
mut body: SizedReader,
do_chunk: bool,
stream: &mut Stream,
) -> IoResult<()> {
if do_chunk {
let mut chunker = chunked_transfer::Encoder::new(stream);
copy(&mut body.reader, &mut chunker)?;