pull the json serializer into it's own module

This commit is contained in:
Erick Tryzelaar
2014-11-14 19:57:53 -08:00
parent 34ee45b794
commit 4ce5ae8025
4 changed files with 684 additions and 680 deletions
+2 -3
View File
@@ -12,7 +12,6 @@ use ser;
use super::PrettySerializer;
use super::Serializer;
use super::SerializeResult;
use super::Error;
use super::{
MissingFieldError,
@@ -40,14 +39,14 @@ pub enum Value {
impl Value {
/// Serializes a json value into an io::writer. Uses a single line.
pub fn to_writer<W: Writer>(&self, wr: W) -> SerializeResult {
pub fn to_writer<W: Writer>(&self, wr: W) -> IoResult<()> {
let mut serializer = Serializer::new(wr);
self.serialize(&mut serializer)
}
/// Serializes a json value into an io::writer.
/// Pretty-prints in a more readable format.
pub fn to_pretty_writer<W: Writer>(&self, wr: W) -> SerializeResult {
pub fn to_pretty_writer<W: Writer>(&self, wr: W) -> IoResult<()> {
let mut serializer = PrettySerializer::new(wr);
self.serialize(&mut serializer)
}