Skip to content

Instantly share code, notes, and snippets.

@jaredly
Created November 19, 2014 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaredly/fec82bd2bea8b497b1b3 to your computer and use it in GitHub Desktop.
Save jaredly/fec82bd2bea8b497b1b3 to your computer and use it in GitHub Desktop.
#[deriving(Clone)]
#[deriving(Decodable, Encodable)]
#[deriving(Show)]
struct DoneCompiled {
compileError: String,
stdout: String,
stderr: String,
}
impl<'a, T: Encodable<Encoder<'a>, std::io::IoError>> Bodyable for T {
fn set_body(self, res: &mut Response) {
let s = json::encode(&self);
let m = MemReader::new(s.into_bytes());
res.body = Some(box m as Box<Reader+Send>)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment