Added missing "Errors" and "Panics" sections to request.rs and response.rs
This commit is contained in:
		| @@ -153,6 +153,11 @@ impl RequestBuilder { | |||||||
|     /// # Ok(()) |     /// # Ok(()) | ||||||
|     /// # } |     /// # } | ||||||
|     /// ``` |     /// ``` | ||||||
|  |     /// | ||||||
|  |     /// # Errors | ||||||
|  |     /// | ||||||
|  |     /// This method fails if the passed value cannot be serialized into | ||||||
|  |     /// url encoded format | ||||||
|     pub fn form<T: Serialize>(&mut self, form: &T) -> ::Result<&mut RequestBuilder> { |     pub fn form<T: Serialize>(&mut self, form: &T) -> ::Result<&mut RequestBuilder> { | ||||||
|         { |         { | ||||||
|             // check request_mut() before running serde |             // check request_mut() before running serde | ||||||
| @@ -202,6 +207,11 @@ impl RequestBuilder { | |||||||
|  |  | ||||||
|     /// Build a `Request`, which can be inspected, modified and executed with |     /// Build a `Request`, which can be inspected, modified and executed with | ||||||
|     /// `Client::execute()`. |     /// `Client::execute()`. | ||||||
|  |     /// | ||||||
|  |     /// # Panics | ||||||
|  |     /// | ||||||
|  |     /// This method consumes builder internal state. It panics on an attempt to | ||||||
|  |     /// reuse already consumed builder. | ||||||
|     pub fn build(&mut self) -> Request { |     pub fn build(&mut self) -> Request { | ||||||
|         self.request |         self.request | ||||||
|             .take() |             .take() | ||||||
| @@ -209,6 +219,11 @@ impl RequestBuilder { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /// Constructs the Request and sends it the target URL, returning a Response. |     /// Constructs the Request and sends it the target URL, returning a Response. | ||||||
|  |     /// | ||||||
|  |     /// # Errors | ||||||
|  |     /// | ||||||
|  |     /// This method fails if there was an error while sending request, | ||||||
|  |     /// redirect loop was detected or redirect limit was exhausted. | ||||||
|     pub fn send(&mut self) -> ::Result<::Response> { |     pub fn send(&mut self) -> ::Result<::Response> { | ||||||
|         let request = self.build(); |         let request = self.build(); | ||||||
|         self.client.execute(request) |         self.client.execute(request) | ||||||
|   | |||||||
| @@ -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] |     #[inline] | ||||||
|     pub fn json<T: DeserializeOwned>(&mut self) -> ::Result<T> { |     pub fn json<T: DeserializeOwned>(&mut self) -> ::Result<T> { | ||||||
|         serde_json::from_reader(self).map_err(::error::from) |         serde_json::from_reader(self).map_err(::error::from) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user