feat(http): use the bytes crate for Chunk and internally
This commit is contained in:
		| @@ -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))) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user