Last active
August 29, 2015 14:13
-
-
Save pzol/786bf97c960d71c45b85 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 std::io::{self, IoResult, MemReader}; | |
use rustc_serialize::{ Encodable }; | |
use rustc_serialize::json::{ self, Json }; | |
use response::IntoReader; | |
pub trait IntoReader { | |
type OutReader: Reader; | |
fn into_reader(self) -> Self::OutReader; | |
} | |
impl IntoReader for Json { | |
type OutReader = MemReader; | |
fn into_reader<T: Encodable>(self) -> MemReader { | |
MemReader::new(json::encode(&self).into_bytes()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment