-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
61: Pretty configuration options r=torkleyy a=kvark Fixes #58 ~~BREAKING CHANGE~~
- Loading branch information
Showing
8 changed files
with
112 additions
and
52 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
extern crate ron; | ||
#[macro_use] | ||
extern crate serde_derive; | ||
extern crate serde; | ||
|
||
use std::collections::HashMap; | ||
|
||
|
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
//! Provides pretty serialization with `to_string`. | ||
//! Provides default pretty serialization with `to_string`. | ||
|
||
use super::{Pretty, Result, Serializer}; | ||
use super::{Result, to_string_pretty}; | ||
|
||
use serde::ser::Serialize; | ||
use std::default::Default; | ||
|
||
/// Serializes `value` in the recommended RON layout. | ||
/// Serializes `value` in the recommended RON layout with | ||
/// default pretty configuration. | ||
pub fn to_string<T>(value: &T) -> Result<String> | ||
where T: Serialize | ||
{ | ||
let mut s = Serializer { | ||
output: String::new(), | ||
pretty: Some(Pretty { indent: 0 }), | ||
struct_names: false, | ||
}; | ||
value.serialize(&mut s)?; | ||
Ok(s.output) | ||
to_string_pretty(value, Default::default()) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
extern crate ron; | ||
#[macro_use] | ||
extern crate serde_derive; | ||
extern crate serde; | ||
|
||
use std::collections::HashMap; | ||
|
||
|