pub struct SerializeConfig {
pub format: FormatConfig,
pub include_type_attribute: bool,
}Expand description
Configuration for serializing typed RON documents.
This controls how types are serialized to RON format, including whether
to include the #![type = "..."] attribute for LSP support.
§Example
ⓘ
use ron2::{ToRonDocument, SerializeConfig};
let config = Config { port: 8080 };
// With type attribute (default)
let ron = config.to_typed_ron()?;
// #![type = "my_crate::Config"]
//
// Config(port: 8080)
// Without type attribute
let ron = config.to_typed_ron_with(&SerializeConfig::without_type_attribute())?;
// Config(port: 8080)Fields§
§format: FormatConfigFormat configuration for the output.
include_type_attribute: boolWhether to include the #![type = "..."] attribute.
Implementations§
Source§impl SerializeConfig
impl SerializeConfig
Sourcepub fn without_type_attribute() -> Self
pub fn without_type_attribute() -> Self
Create a config that excludes the type attribute.
Sourcepub fn format(self, format: FormatConfig) -> Self
pub fn format(self, format: FormatConfig) -> Self
Set the format configuration.
Sourcepub fn type_attribute(self, include: bool) -> Self
pub fn type_attribute(self, include: bool) -> Self
Set whether to include the type attribute.
Trait Implementations§
Source§impl Clone for SerializeConfig
impl Clone for SerializeConfig
Source§fn clone(&self) -> SerializeConfig
fn clone(&self) -> SerializeConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SerializeConfig
impl Debug for SerializeConfig
Auto Trait Implementations§
impl Freeze for SerializeConfig
impl RefUnwindSafe for SerializeConfig
impl Send for SerializeConfig
impl Sync for SerializeConfig
impl Unpin for SerializeConfig
impl UnwindSafe for SerializeConfig
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
Mutably borrows from an owned value. Read more