summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHampus Lidin <hampuslidin@gmail.com>2020-09-02 00:01:07 +0200
committerGitHub <noreply@github.com>2020-09-01 18:01:07 -0400
commit49afd94f8d084ac028920c1785b2ddb05c13bef3 (patch)
treedc989607306fc8b67c14d0bb6c5093bde0e21872
parent4b399f576e219c8b407aaba7049e87f11beac716 (diff)
downloadshiplift-49afd94f8d084ac028920c1785b2ddb05c13bef3.tar.gz
shiplift-49afd94f8d084ac028920c1785b2ddb05c13bef3.tar.xz
Implement multiple chunk streams in build function for images (#232)
Co-authored-by: Hampus Lidin <hampus.lidin@astrazeneca.com>
-rw-r--r--src/lib.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 06b31a1..c810ea5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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)
}