Last active
August 29, 2015 14:24
-
-
Save jordansissel/b5d3fd3524654d1d9be2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use rustc_serialize::json::{Json,Decoder}; | |
use rustc_serialize::Decodable; | |
use std::io::Read; | |
pub fn parse<T: Read, R: Decodable, E>(mut r: T) -> Result<R, E> { | |
let item = try!(Json::from_reader(&mut r)); | |
let mut decoder = Decoder::new(item); | |
let result: R = try!(Decodable::decode(&mut decoder)); | |
Ok(result) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<std macros>:6:1: 6:32 error: the trait `core::convert::From<rustc_serialize::json::ParserError>` is not implemented for the type `E` [E0277] | |
<std macros>:6 $ crate:: convert:: From:: from ( err ) ) } } ) | |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
<std macros>:1:1: 6:48 note: in expansion of try! | |
src/github/body.rs:6:14: 6:45 note: expansion site | |
<std macros>:6:1: 6:32 error: the trait `core::convert::From<rustc_serialize::json::DecoderError>` is not implemented for the type `E` [E0277] | |
<std macros>:6 $ crate:: convert:: From:: from ( err ) ) } } ) | |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
<std macros>:1:1: 6:48 note: in expansion of try! | |
src/github/body.rs:9:19: 9:56 note: expansion site | |
error: aborting due to 2 previous errors |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment