#[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, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.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> 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> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self using data from the given World.