async/reponse: return a impl Future on json()

This commit is contained in:
Luca Bruno
2019-02-15 08:54:51 +00:00
committed by Sean McArthur
parent 7eae51f56e
commit 5e38b419f0

View File

@@ -127,7 +127,7 @@ impl Response {
/// Try to deserialize the response body as JSON using `serde`.
#[inline]
pub fn json<T: DeserializeOwned>(&mut self) -> Json<T> {
pub fn json<T: DeserializeOwned>(&mut self) -> impl Future<Item = T, Error = ::Error> {
let body = mem::replace(&mut self.body, Decoder::empty());
Json {