feat(chunk): implement Extend and IntoIterator for Chunk
The real reason to provide these implementations is so that `concat` on the `Body` can work to easily join all the chunks into 1.
This commit is contained in:
		| @@ -96,3 +96,18 @@ fn _assert_send_sync() { | ||||
|     _assert_send::<Chunk>(); | ||||
|     _assert_sync::<Chunk>(); | ||||
| } | ||||
|  | ||||
| #[test] | ||||
| fn test_body_stream_concat() { | ||||
|     use futures::{Sink, Stream, Future}; | ||||
|     let (tx, body) = Body::pair(); | ||||
|  | ||||
|     ::std::thread::spawn(move || { | ||||
|         let tx = tx.send(Ok("hello ".into())).wait().unwrap(); | ||||
|         tx.send(Ok("world".into())).wait().unwrap(); | ||||
|     }); | ||||
|  | ||||
|     let total = body.concat().wait().unwrap(); | ||||
|     assert_eq!(total.as_ref(), b"hello world"); | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user