diff options
author | Chris West <solo-github@goeswhere.com> | 2018-10-17 16:59:21 +0100 |
---|---|---|
committer | doug tangren <d.tangren@gmail.com> | 2018-10-17 11:59:21 -0400 |
commit | 75123f82a6f350299f1e9fc74d73dd4406a01cdc (patch) | |
tree | 67dfa8ef3471521f1db04426f3521d8958c04be7 /src/lib.rs | |
parent | 56cc6549012693d869e258f057df8163fab4843f (diff) |
serde can't read a Vec<Value> from a stream (#126)
Fixes #123.
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -181,7 +181,12 @@ impl<'a> Images<'a> { self.docker .stream_post(&path.join("?"), Some((Body::from(bytes), tar()))) - .and_then(|r| serde_json::from_reader::<_, Vec<Value>>(r).map_err(Error::from)) + .and_then(|r| { + serde_json::Deserializer::from_reader(r) + .into_iter::<Value>() + .map(|res| res.map_err(Error::from)) + .collect() + }) } /// Lists the docker images on the current docker host @@ -228,7 +233,12 @@ impl<'a> Images<'a> { } self.docker .stream_post::<Body>(&path.join("?"), None) - .and_then(|r| serde_json::from_reader::<_, Vec<Value>>(r).map_err(Error::from)) + .and_then(|r| { + serde_json::Deserializer::from_reader(r) + .into_iter::<Value>() + .map(|res| res.map_err(Error::from)) + .collect() + }) } /// exports a collection of named images, |