Impl conversion from serde_urlencoded errors.
This commit is contained in:
		
							parent
							
								
									211cf5e353
								
							
						
					
					
						commit
						4893be93f8
					
				| @ -14,6 +14,7 @@ version = "0.3.0" | |||||||
| futures = "0.1.14" | futures = "0.1.14" | ||||||
| hyper = "0.11" | hyper = "0.11" | ||||||
| serde_json = "1.0.2" | serde_json = "1.0.2" | ||||||
|  | serde_urlencoded = "0.5.1" | ||||||
| 
 | 
 | ||||||
| [dev-dependencies] | [dev-dependencies] | ||||||
| ruma-identifiers = "0.11" | ruma-identifiers = "0.11" | ||||||
|  | |||||||
| @ -19,6 +19,7 @@ extern crate hyper; | |||||||
| #[cfg(test)] extern crate serde; | #[cfg(test)] extern crate serde; | ||||||
| #[cfg(test)] #[macro_use] extern crate serde_derive; | #[cfg(test)] #[macro_use] extern crate serde_derive; | ||||||
| extern crate serde_json; | extern crate serde_json; | ||||||
|  | extern crate serde_urlencoded; | ||||||
| 
 | 
 | ||||||
| use std::convert::TryInto; | use std::convert::TryInto; | ||||||
| use std::io; | use std::io; | ||||||
| @ -48,6 +49,8 @@ pub enum Error { | |||||||
|     Io(io::Error), |     Io(io::Error), | ||||||
|     /// A Serde JSON error.
 |     /// A Serde JSON error.
 | ||||||
|     SerdeJson(serde_json::Error), |     SerdeJson(serde_json::Error), | ||||||
|  |     /// A Serde URL encoding error.
 | ||||||
|  |     SerdeUrlEncoded(serde_urlencoded::ser::Error), | ||||||
|     /// An HTTP status code indicating error.
 |     /// An HTTP status code indicating error.
 | ||||||
|     StatusCode(StatusCode), |     StatusCode(StatusCode), | ||||||
|     /// A Uri error.
 |     /// A Uri error.
 | ||||||
| @ -72,6 +75,12 @@ impl From<serde_json::Error> for Error { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | impl From<serde_urlencoded::ser::Error> for Error { | ||||||
|  |     fn from(error: serde_urlencoded::ser::Error) -> Self { | ||||||
|  |         Error::SerdeUrlEncoded(error) | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
| impl From<UriError> for Error { | impl From<UriError> for Error { | ||||||
|     fn from(error: UriError) -> Self { |     fn from(error: UriError) -> Self { | ||||||
|         Error::Uri(error) |         Error::Uri(error) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user