diff options
author | Hampus Lidin <hampuslidin@gmail.com> | 2020-09-02 00:01:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-01 18:01:07 -0400 |
commit | 49afd94f8d084ac028920c1785b2ddb05c13bef3 (patch) | |
tree | dc989607306fc8b67c14d0bb6c5093bde0e21872 | |
parent | 4b399f576e219c8b407aaba7049e87f11beac716 (diff) |
Implement multiple chunk streams in build function for images (#232)
Co-authored-by: Hampus Lidin <hampus.lidin@astrazeneca.com>
-rw-r--r-- | src/lib.rs | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -170,9 +170,18 @@ impl<'a> Images<'a> { None::<iter::Empty<_>>, ); - let value_stream = chunk_stream.and_then(|chunk| async move { - serde_json::from_slice(&chunk).map_err(Error::from) - }); + let value_stream = chunk_stream + .and_then(|chunk| async move { + let stream = futures_util::stream::iter( + serde_json::Deserializer::from_slice(&chunk) + .into_iter() + .collect::<Vec<_>>(), + ) + .map_err(Error::from); + + Ok(stream) + }) + .try_flatten(); Ok(value_stream) } |