[][src]Struct ron::ser::PrettyConfig

pub struct PrettyConfig {
    pub depth_limit: usize,
    pub new_line: String,
    pub indentor: String,
    pub separate_tuple_members: bool,
    pub enumerate_arrays: bool,
    pub decimal_floats: bool,
    pub extensions: Extensions,
    // some fields omitted
}

Pretty serializer configuration.

Examples

use ron::ser::PrettyConfig;

let my_config = PrettyConfig::new()
    .with_depth_limit(4)
    // definitely superior (okay, just joking)
    .with_indentor("\t".to_owned());

Fields

depth_limit: usize

Limit the pretty-ness up to the given depth.

new_line: String

New line string

indentor: String

Indentation string

separate_tuple_members: bool

Separate tuple members with indentation

enumerate_arrays: bool

Enumerate array items in comments

decimal_floats: bool

Always include the decimal in floats

extensions: Extensions

Enable extensions. Only configures 'implicit_some' for now.

Implementations

impl PrettyConfig[src]

pub fn new() -> Self[src]

Creates a default PrettyConfig.

pub fn with_depth_limit(self, depth_limit: usize) -> Self[src]

Limits the pretty-formatting based on the number of indentations. I.e., with a depth limit of 5, starting with an element of depth (indentation level) 6, everything will be put into the same line, without pretty formatting.

Default: std::usize::MAX

pub fn with_new_line(self, new_line: String) -> Self[src]

Configures the newlines used for serialization.

Default: \r\n on Windows, \n otherwise

pub fn with_indentor(self, indentor: String) -> Self[src]

Configures the string sequence used for indentation.

Default: 4 spaces

pub fn with_separate_tuple_members(self, separate_tuple_members: bool) -> Self[src]

Configures whether tuples are single- or multi-line. If set to true, tuples will have their fields indented and in new lines. If set to false, tuples will be serialized without any newlines or indentations.

Default: false

pub fn with_enumerate_arrays(self, enumerate_arrays: bool) -> Self[src]

Configures whether a comment shall be added to every array element, indicating the index.

Default: false

pub fn with_decimal_floats(self, decimal_floats: bool) -> Self[src]

Configures whether floats should always include a decimal. When false 1.0 will serialize as 1 When true 1.0 will serialize as 1.0

Default: false

pub fn with_extensions(self, extensions: Extensions) -> Self[src]

Configures extensions

Default: Extensions::empty()

Trait Implementations

impl Clone for PrettyConfig[src]

impl Debug for PrettyConfig[src]

impl Default for PrettyConfig[src]

impl<'de> Deserialize<'de> for PrettyConfig[src]

impl Serialize for PrettyConfig[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.