Added missing "Errors" and "Panics" sections to request.rs and response.rs

This commit is contained in:
Michal Budzynski
2017-06-04 04:49:33 +02:00
parent 026dca2512
commit e3bf6756f4
2 changed files with 22 additions and 0 deletions

View File

@@ -100,6 +100,13 @@ impl Response {
/// # }
/// # }
/// ```
///
/// # Errors
///
/// This method fails whenever the response body is not in JSON format
/// or it cannot be properly deserialized to target type `T`. For more
/// details please see [`serde_json::from_reader`].
/// [`serde_json::from_reader`]: https://docs.serde.rs/serde_json/fn.from_reader.html
#[inline]
pub fn json<T: DeserializeOwned>(&mut self) -> ::Result<T> {
serde_json::from_reader(self).map_err(::error::from)