#[non_exhaustive]pub struct PrettyConfig {
pub depth_limit: usize,
pub new_line: String,
pub indentor: String,
pub separator: String,
pub struct_names: bool,
pub separate_tuple_members: bool,
pub enumerate_arrays: bool,
pub extensions: Extensions,
pub compact_arrays: bool,
}Expand description
Pretty serializer configuration.
§Examples
use ron::ser::PrettyConfig;
let my_config = PrettyConfig::new()
.depth_limit(4)
// definitely superior (okay, just joking)
.indentor("\t".to_owned());Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.depth_limit: usizeLimit the pretty-ness up to the given depth.
new_line: StringNew line string
indentor: StringIndentation string
separator: StringSeparator string
struct_names: bool§separate_tuple_members: boolSeparate tuple members with indentation
enumerate_arrays: boolEnumerate array items in comments
extensions: ExtensionsEnable extensions. Only configures ‘implicit_some’, ‘unwrap_newtypes’, and ‘unwrap_variant_newtypes’ for now.
compact_arrays: boolEnable compact arrays
Implementations§
Source§impl PrettyConfig
impl PrettyConfig
Sourcepub fn new() -> PrettyConfig
pub fn new() -> PrettyConfig
Creates a default PrettyConfig.
Sourcepub fn depth_limit(self, depth_limit: usize) -> PrettyConfig
pub fn depth_limit(self, depth_limit: usize) -> PrettyConfig
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: usize::MAX
Sourcepub fn new_line(self, new_line: String) -> PrettyConfig
pub fn new_line(self, new_line: String) -> PrettyConfig
Configures the newlines used for serialization.
Default: \r\n on Windows, \n otherwise
Sourcepub fn indentor(self, indentor: String) -> PrettyConfig
pub fn indentor(self, indentor: String) -> PrettyConfig
Configures the string sequence used for indentation.
Default: 4 spaces
Sourcepub fn separator(self, separator: String) -> PrettyConfig
pub fn separator(self, separator: String) -> PrettyConfig
Configures the string sequence used to separate items inline.
Default: 1 space
Sourcepub fn struct_names(self, struct_names: bool) -> PrettyConfig
pub fn struct_names(self, struct_names: bool) -> PrettyConfig
Configures whether to emit struct names.
Default: false
Sourcepub fn separate_tuple_members(
self,
separate_tuple_members: bool,
) -> PrettyConfig
pub fn separate_tuple_members( self, separate_tuple_members: bool, ) -> PrettyConfig
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
Sourcepub fn enumerate_arrays(self, enumerate_arrays: bool) -> PrettyConfig
pub fn enumerate_arrays(self, enumerate_arrays: bool) -> PrettyConfig
Configures whether a comment shall be added to every array element, indicating the index.
Default: false
Sourcepub fn compact_arrays(self, compact_arrays: bool) -> PrettyConfig
pub fn compact_arrays(self, compact_arrays: bool) -> PrettyConfig
Configures whether every array should be a single line (true)
or a multi line one (false).
When false, ["a","b"] (as well as any array) will serialize to
[
"a",
"b",
]When true, ["a","b"] (as well as any array) will serialize to
["a","b"]Default: false
Sourcepub fn extensions(self, extensions: Extensions) -> PrettyConfig
pub fn extensions(self, extensions: Extensions) -> PrettyConfig
Configures extensions
Default: Extensions::empty()
Trait Implementations§
Source§impl Clone for PrettyConfig
impl Clone for PrettyConfig
Source§fn clone(&self) -> PrettyConfig
fn clone(&self) -> PrettyConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PrettyConfig
impl Debug for PrettyConfig
Source§impl Default for PrettyConfig
impl Default for PrettyConfig
Source§fn default() -> PrettyConfig
fn default() -> PrettyConfig
Source§impl<'de> Deserialize<'de> for PrettyConfigwhere
PrettyConfig: Default,
impl<'de> Deserialize<'de> for PrettyConfigwhere
PrettyConfig: Default,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PrettyConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PrettyConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for PrettyConfig
impl Serialize for PrettyConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for PrettyConfig
impl RefUnwindSafe for PrettyConfig
impl Send for PrettyConfig
impl Sync for PrettyConfig
impl Unpin for PrettyConfig
impl UnwindSafe for PrettyConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().