feat(http): use the bytes crate for Chunk and internally

This commit is contained in:
Sean McArthur
2017-03-01 14:14:34 -08:00
parent cf7cc50ad0
commit 65b3e08f69
14 changed files with 306 additions and 598 deletions

View File

@@ -1,9 +1,9 @@
use std::convert::From;
use tokio_proto;
use http::Chunk;
use bytes::Bytes;
use futures::{Poll, Stream};
use futures::sync::mpsc;
use tokio_proto;
use http::Chunk;
pub type TokioBody = tokio_proto::streaming::Body<Chunk, ::Error>;
@@ -58,6 +58,12 @@ impl From<Chunk> for Body {
}
}
impl From<Bytes> for Body {
fn from (bytes: Bytes) -> Body {
Body(TokioBody::from(Chunk::from(bytes)))
}
}
impl From<Vec<u8>> for Body {
fn from (vec: Vec<u8>) -> Body {
Body(TokioBody::from(Chunk::from(vec)))